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
This commit is contained in:
Paolo Carlini 2011-06-09 15:06:59 +00:00 committed by Paolo Carlini
parent 547fdef870
commit 0d1d0dc8aa
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
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>
PR c++/49107

View File

@ -8441,6 +8441,13 @@ grokdeclarator (const cp_declarator *declarator,
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
must be one of the parameters of a function
(because the body is at least two levels down). */

View File

@ -1,3 +1,8 @@
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>
PR middle-end/49308

View File

@ -0,0 +1,3 @@
// PR c++/29003
typedef int operator !(); // { dg-error "declaration" }