re PR c++/58810 (ICE with invalid function typedef)

/cp
2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58810
	* decl.c (grokdeclarator): Don't handle qualified free functions here,
	leave the diagnostic to grokfndecl.

/testsuite
2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58810
	* g++.dg/other/cv_func3.C: New.
	* g++.dg/other/cv_func.C: Adjust.
	* g++.dg/parse/fn-typedef2.C: Likewise.

From-SVN: r205356
This commit is contained in:
Paolo Carlini 2013-11-25 16:10:29 +00:00
parent 80e8745780
commit 6f640d1576
6 changed files with 28 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2013-11-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58810
* decl.c (grokdeclarator): Don't handle qualified free functions here,
leave the diagnostic to grokfndecl.
2013-11-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59080

View File

@ -10256,21 +10256,6 @@ grokdeclarator (const cp_declarator *declarator,
if (decl_context != TYPENAME)
{
/* A cv-qualifier-seq shall only be part of the function type
for a non-static member function. A ref-qualifier shall only
.... /same as above/ [dcl.fct] */
if ((type_memfn_quals (type) != TYPE_UNQUALIFIED
|| type_memfn_rqual (type) != REF_QUAL_NONE)
&& (current_class_type == NULL_TREE || staticp) )
{
error (staticp
? G_("qualified function types cannot be used to "
"declare static member functions")
: G_("qualified function types cannot be used to "
"declare free functions"));
type = TYPE_MAIN_VARIANT (type);
}
/* The qualifiers on the function type become the qualifiers on
the non-static member function. */
memfn_quals |= type_memfn_quals (type);

View File

@ -1,3 +1,10 @@
2013-11-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58810
* g++.dg/other/cv_func3.C: New.
* g++.dg/other/cv_func.C: Adjust.
* g++.dg/parse/fn-typedef2.C: Likewise.
2013-11-25 Marek Polacek <polacek@redhat.com>
PR sanitizer/59250
@ -20,9 +27,9 @@
PR c++/59112
PR c++/59113
g++.dg/cpp1y/pr58533.C: Updated testcase.
g++.dg/cpp1y/pr59112.C: New testcase.
g++.dg/cpp1y/pr59113.C: New testcase.
* g++.dg/cpp1y/pr58533.C: Updated testcase.
* g++.dg/cpp1y/pr59112.C: New testcase.
* g++.dg/cpp1y/pr59113.C: New testcase.
2013-11-25 Terry Guo <terry.guo@arm.com>

View File

@ -3,7 +3,7 @@
typedef int FIC(int) const;
typedef int FI(int);
FIC f; // { dg-error "qualified" }
FIC f; // { dg-error "cv-qualifier" }
struct S {
FIC f; // OK

View File

@ -0,0 +1,10 @@
// PR c++/58810
typedef int F() const;
F f; // { dg-error "cv-qualifier" }
struct A
{
friend F f; // { dg-error "cv-qualifier" }
};

View File

@ -4,4 +4,4 @@ typedef void ft() const;
typedef void V;
typedef V ft() const;
ft f; // { dg-error "qualified" }
ft f; // { dg-error "cv-qualifier" }