Commit 106fcf8f by Paolo Carlini

re PR c++/41769 (Parameter names not restricted to identifiers)

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

	PR c++/41769
	* decl.c (grokdeclarator): Reject operator names in parameters.

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

	PR c++/41769
	* g++.dg/parse/error39.C: New.

From-SVN: r174927
parent 41817394
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/41769
* decl.c (grokdeclarator): Reject operator names in parameters.
2011-06-10 Jan Hubicka <jh@suse.cz>
* decl2.c (clear_decl_external): New functoin.
......
......@@ -8441,12 +8441,19 @@ grokdeclarator (const cp_declarator *declarator,
return error_mark_node;
}
if (dname && IDENTIFIER_OPNAME_P (dname)
&& declspecs->specs[(int)ds_typedef])
if (dname && IDENTIFIER_OPNAME_P (dname))
{
if (declspecs->specs[(int)ds_typedef])
{
error ("declaration of %qD as %<typedef%>", dname);
return error_mark_node;
}
else if (decl_context == PARM || decl_context == CATCHPARM)
{
error ("declaration of %qD as parameter", dname);
return error_mark_node;
}
}
/* Anything declared one level down from the top level
must be one of the parameters of a function
......
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/41769
* g++.dg/parse/error39.C: New.
2011-06-10 Janis Johnson <janisjo@codesourcery.com>
* gcc/testsuite/gcc.target/arm/20090811-1.c: Skip for incompatible
......@@ -587,8 +592,8 @@
* objc.dg/fsf-package-0.m: Use TestsuiteObject instead of Object.
Do not include objc/objc-api.h.
* obj-c++.dg/fsf-package-0.mm: Likewise.
* objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c (switchfiles):
Include objc/runtime.h instead of objc/encoding.h.
* objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c
(switchfiles): Include objc/runtime.h instead of objc/encoding.h.
* objc.dg/gnu-runtime-1.m: Updated to use TestsuiteObject instead
of Object.
* obj-c++.dg/gnu-runtime-1.mm: Likewise.
......
// PR c++/41769
void f(void operator+()); // { dg-error "declaration" }
void g()
{
try
{
}
catch(void 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