re PR c++/9278 (Illegal use of typedef to "void")
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
This commit is contained in:
parent
dd6f2a4378
commit
e7e5319243
4 changed files with 28 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
16
gcc/testsuite/g++.dg/other/void1.C
Normal file
16
gcc/testsuite/g++.dg/other/void1.C
Normal file
|
@ -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" }
|
||||
};
|
Loading…
Add table
Reference in a new issue