This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH, C++] Fix PR63366: __complex not equivalent to __complex double in C++


> From: Nathan Sidwell [mailto:nathan@codesourcery.com]
> Sent: Thursday, October 09, 2014 2:30 PM
> On 10/09/14 09:25, Jason Merrill wrote:
> > I would think we want to handle this up in the existing defaulted_int
> block:
> my thought was to at least put it next to the explicit_int = -1 above.

It seems more sensible to keep it in this block as the existing
defaulted_int block is for types for which it is not an error to omit the
int type specifier.

Here is an updated patch which moves the statement as requested by
Nathan:

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d26a432..f382e27 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9187,6 +9187,7 @@ grokdeclarator (const cp_declarator *declarator,
       int is_main;
 
       explicit_int = -1;
+      defaulted_int = 1;
 
       /* We handle `main' specially here, because 'main () { }' is so
 	 common.  With no options, it is allowed.  With -Wreturn-type,
diff --git a/gcc/testsuite/g++.dg/torture/pr63366.C b/gcc/testsuite/g++.dg/torture/pr63366.C
new file mode 100644
index 0000000..af59b98
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr63366.C
@@ -0,0 +1,11 @@
+// { dg-do run }
+// { dg-options "-fpermissive" }
+// { dg-prune-output "ISO C\\+\\+ forbids declaration of 'type name' with no type" }
+
+#include <typeinfo>
+
+int
+main (void)
+{
+  return typeid (__complex) != typeid (__complex double);
+}

ChangeLog unchanged. Ok for trunk?

Best regards,

Thomas




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]