]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/9278 (Illegal use of typedef to "void")
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Fri, 25 Nov 2005 14:59:09 +0000 (14:59 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 25 Nov 2005 14:59:09 +0000 (14:59 +0000)
PR c++/9278
* decl.c (grokparms): Do not allow typedef-names in a '(void)'
parmlist.

* g++.dg/other/void1.C: New test.

From-SVN: r107508

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/void1.C [new file with mode: 0644]

index d97fe45359ec9a8d630e10dfdc58b61ce3a1cfd9..5e5df9b45726d536f1e0cdbd0ef60b10e8c6fa36 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-25  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/9278
+       * decl.c (grokparms): Do not allow typedef-names in a '(void)'
+       parmlist.
+
 2005-11-25  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        * typeck2.c (process_init_constructor_union): Remove check for
index d87983c1cb9fb05b039ee60e8ade89d42c839c5f..dec134a1fde5d3e6b0bb5dcb0d64e31ad0eb1677 100644 (file)
@@ -8598,6 +8598,7 @@ grokparms (cp_parameter_declarator *first_parm, tree *parms)
       if (VOID_TYPE_P (type))
        {
          if (same_type_p (type, void_type_node)
+             && DECL_SELF_REFERENCE_P (type)
              && !DECL_NAME (decl) && !result && !parm->next && !ellipsis)
            /* this is a parmlist of `(void)', which is ok.  */
            break;
index 10263032a91e2d30ea9739a05fbad4e32d351291..35d0b51b3bd8f047991c75b195d46a8a90744302 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-25  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/9278
+       * g++.dg/other/void1.C: New test.
+
 2005-11-25  Joseph S. Myers  <joseph@codesourcery.com>
 
        PR middle-end/24998
diff --git a/gcc/testsuite/g++.dg/other/void1.C b/gcc/testsuite/g++.dg/other/void1.C
new file mode 100644 (file)
index 0000000..691e6f7
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/9278
+// { dg-do compile }
+
+typedef void VOID;
+
+int foo(void);
+int bar(VOID);                // { dg-error "type|invalid use" }
+
+template<int> int foo(void);
+template<int> int bar(VOID);  // { dg-error "type|invalid use" }
+
+struct A
+{
+  int foo(void);
+  int bar(VOID);              // { dg-error "type|invalid use" }
+};
This page took 0.106 seconds and 5 git commands to generate.