Commit d1307360 by Paolo Carlini Committed by Paolo Carlini

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
parent fb112177
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:
......
......@@ -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))
{
......
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.
......
// PR c++/33972
struct s
{
typedef void f(void);
f operator();
};
......@@ -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" }
};
//PR c++/27670
template<operator+> void foo(); // { dg-error "before|non-function|template" }
template<operator+> void foo(); // { dg-error "before|parameter|template" }
void bar()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment