* [C++ Patch] PR 41769
@ 2011-06-10 18:42 Paolo Carlini
2011-06-10 18:45 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2011-06-10 18:42 UTC (permalink / raw)
To: gcc-patches; +Cc: Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
Hi,
as it happens, a couple of years ago Johannes filed a PR quite similar
to 29003 but for function parameters, and we have a similar issue for
catch clauses too. Patch tested x86_64-linux.
Is it Ok?
Thanks,
Paolo.
/////////////////////
[-- Attachment #2: CL_41769 --]
[-- Type: text/plain, Size: 251 bytes --]
/cp
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29003
* decl.c (grokdeclarator): Reject operator names in parameters.
/testsuite
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29003
* g++.dg/parse/error39.C: New.
[-- Attachment #3: patch_41769 --]
[-- Type: text/plain, Size: 1265 bytes --]
Index: testsuite/g++.dg/parse/error39.C
===================================================================
--- testsuite/g++.dg/parse/error39.C (revision 0)
+++ testsuite/g++.dg/parse/error39.C (revision 0)
@@ -0,0 +1,14 @@
+// PR c++/41769
+
+void f(void operator+()); // { dg-error "declaration" }
+
+void g()
+{
+ try
+ {
+
+ }
+ catch(void operator+()) // { dg-error "declaration" }
+ {
+ }
+}
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 174918)
+++ cp/decl.c (working copy)
@@ -8441,11 +8441,18 @@ 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))
{
- error ("declaration of %qD as %<typedef%>", dname);
- return error_mark_node;
+ 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C++ Patch] PR 41769
2011-06-10 18:42 [C++ Patch] PR 41769 Paolo Carlini
@ 2011-06-10 18:45 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2011-06-10 18:45 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches
OK.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-10 18:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10 18:42 [C++ Patch] PR 41769 Paolo Carlini
2011-06-10 18:45 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).