Ping?

> -----Original Message-----
> From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-
> ow...@gcc.gnu.org] On Behalf Of Thomas Preud'homme
> Sent: Monday, September 29, 2014 3:33 PM
> To: gcc-patches@gcc.gnu.org
> Subject: [PATCH, C++] Fix PR63366: __complex not equivalent to
> __complex double in C++
> 
> According to a comment in grokdeclarator in file gcc/cp/decl.c:
> 
>     /* If we just have "complex", it is equivalent to
>     "complex double", but if any modifiers at all are specified it is
>     the complex form of TYPE. E.g, "complex short" is
>     "complex short int". */
> 
> Yet, __complex is equivalent to __complex int as shows the following
> testcase:
> 
> #include <typeinfo>
> 
> int
> main (void)
> {
>   return typeid (__complex) != typeid (__complex int);
> }
> 
> The following patch fix the problem.
> 
> 
> ChangeLog are as follows:
> 
> *** gcc/cp/ChangeLog ***
> 
> 2014-09-26  Thomas Preud'homme  <thomas.preudho...@arm.com>
> 
>       PR C++/63366
>       * decl.c (grokdeclarator): Set defaulted_int when defaulting to
> int
>       because type is null.
> 
> *** gcc/testsuite/ChangeLog ***
> 
> 2014-10-26  Thomas Preud'homme  <thomas.preudho...@arm.com>
> 
>       PR C++/63366
>       * g++.dg/torture/pr63366.C: New test.
> 
> 
> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
> index d26a432..449efdf 100644
> --- a/gcc/cp/decl.c
> +++ b/gcc/cp/decl.c
> @@ -9212,6 +9212,7 @@ grokdeclarator (const cp_declarator *declarator,
>                   "ISO C++ forbids declaration of %qs with no type", name);
> 
>        type = integer_type_node;
> +      defaulted_int = 1;
>      }
> 
>    ctype = NULL_TREE;
> 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);
> +}
> 
> 
> Is this ok for trunk?
> 
> Best regards,
> 
> Thomas Preud'homme
> 
> 
> 




Reply via email to