Commit e7e53192 by Volker Reichelt Committed by Volker Reichelt

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
parent dd6f2a43
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
unnamed union members.
......
......@@ -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;
......
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
// 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" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment