re PR c++/33972 (Cannot declare operator() using function typedef)

/cp
2014-06-24  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/33972
	* decl.c (grokdeclarator): Do not early check for operator-function-id
	as non-function.

/testsuite
2014-06-24  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/33972
	* g++.dg/other/operator3.C: New.
	* g++.dg/template/operator8.C: Adjust.
	* g++.dg/template/operator9.C: Likewise.

From-SVN: r211944
This commit is contained in:
Paolo Carlini 2014-06-24 14:47:42 +00:00 committed by Paolo Carlini
parent fb11217748
commit d13073607f
6 changed files with 23 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2014-06-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/33972
* decl.c (grokdeclarator): Do not early check for operator-function-id
as non-function.
2014-06-24 Trevor Saunders <tsaunders@mozilla.com>
* class.c, semantics.c, tree.c, vtable-class-hierarchy.c:

View file

@ -9007,7 +9007,7 @@ grokdeclarator (const cp_declarator *declarator,
return error_mark_node;
}
if (((dname && IDENTIFIER_OPNAME_P (dname)) || flags == TYPENAME_FLAG)
if (flags == TYPENAME_FLAG
&& innermost_code != cdk_function
&& ! (ctype && !declspecs->any_specifiers_p))
{

View file

@ -1,3 +1,10 @@
2014-06-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/33972
* g++.dg/other/operator3.C: New.
* g++.dg/template/operator8.C: Adjust.
* g++.dg/template/operator9.C: Likewise.
2014-06-24 Alan Lawrence <alan.lawrence@arm.com>
* gcc.target/aarch64/singleton_intrinsics_1.c: Save temps and cleanup.

View file

@ -0,0 +1,7 @@
// PR c++/33972
struct s
{
typedef void f(void);
f operator();
};

View file

@ -2,5 +2,5 @@
struct A
{
template<operator+> void foo() {} // { dg-error "identifier|non-function|template arguments" }
template<operator+> void foo() {} // { dg-error "identifier|parameter|template arguments" }
};

View file

@ -1,6 +1,6 @@
//PR c++/27670
template<operator+> void foo(); // { dg-error "before|non-function|template" }
template<operator+> void foo(); // { dg-error "before|parameter|template" }
void bar()
{