Commit 0d1d0dc8 by Paolo Carlini Committed by Paolo Carlini

re PR c++/29003 (operator name accepted in typedef)

/cp
2011-06-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/29003
	* decl.c (grokdeclarator): Reject operator names in typedefs.

/testsuite
2011-06-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/29003
	* g++.dg/parse/error38.C: New.

From-SVN: r174846
parent 547fdef8
2011-06-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29003
* decl.c (grokdeclarator): Reject operator names in typedefs.
2011-06-08 Jason Merrill <jason@redhat.com> 2011-06-08 Jason Merrill <jason@redhat.com>
PR c++/49107 PR c++/49107
......
...@@ -8441,6 +8441,13 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8441,6 +8441,13 @@ grokdeclarator (const cp_declarator *declarator,
return error_mark_node; return error_mark_node;
} }
if (dname && IDENTIFIER_OPNAME_P (dname)
&& declspecs->specs[(int)ds_typedef])
{
error ("declaration of %qD as %<typedef%>", dname);
return error_mark_node;
}
/* Anything declared one level down from the top level /* Anything declared one level down from the top level
must be one of the parameters of a function must be one of the parameters of a function
(because the body is at least two levels down). */ (because the body is at least two levels down). */
......
2011-06-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29003
* g++.dg/parse/error38.C: New.
2011-06-09 Jakub Jelinek <jakub@redhat.com> 2011-06-09 Jakub Jelinek <jakub@redhat.com>
PR middle-end/49308 PR middle-end/49308
......
// PR c++/29003
typedef int operator !(); // { dg-error "declaration" }
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