Commit e7402b3a by Paolo Carlini Committed by Paolo Carlini

DR 577 PR c++/33101

/cp
2014-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	DR 577
	PR c++/33101
	* decl.c (grokparms): Accept a single parameter of type 'void'.

/testsuite
2014-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	DR 577
	PR c++/33101
	* g++.dg/other/void1.C: Adjust.
	* g++.dg/other/void3.C: Likewise.

From-SVN: r211906
parent 7b56b2f8
2014-06-23 Paolo Carlini <paolo.carlini@oracle.com>
DR 577
PR c++/33101
* decl.c (grokparms): Accept a single parameter of type 'void'.
2014-06-20 Jason Merrill <jason@redhat.com> 2014-06-20 Jason Merrill <jason@redhat.com>
PR c++/59296 PR c++/59296
......
...@@ -11138,16 +11138,13 @@ grokparms (tree parmlist, tree *parms) ...@@ -11138,16 +11138,13 @@ grokparms (tree parmlist, tree *parms)
type = TREE_TYPE (decl); type = TREE_TYPE (decl);
if (VOID_TYPE_P (type)) if (VOID_TYPE_P (type))
{ {
if (type == void_type_node if (same_type_p (type, void_type_node)
&& !init && !init
&& !DECL_NAME (decl) && !result && !DECL_NAME (decl) && !result
&& TREE_CHAIN (parm) == void_list_node) && TREE_CHAIN (parm) == void_list_node)
/* this is a parmlist of `(void)', which is ok. */ /* DR 577: A parameter list consisting of a single
unnamed parameter of non-dependent type 'void'. */
break; break;
else if (typedef_variant_p (type))
error_at (DECL_SOURCE_LOCATION (decl),
"invalid use of typedef-name %qT in "
"parameter declaration", type);
else if (cv_qualified_p (type)) else if (cv_qualified_p (type))
error_at (DECL_SOURCE_LOCATION (decl), error_at (DECL_SOURCE_LOCATION (decl),
"invalid use of cv-qualified type %qT in " "invalid use of cv-qualified type %qT in "
......
2014-06-23 Paolo Carlini <paolo.carlini@oracle.com>
DR 577
PR c++/33101
* g++.dg/other/void1.C: Adjust.
* g++.dg/other/void3.C: Likewise.
2014-06-23 Marek Polacek <polacek@redhat.com> 2014-06-23 Marek Polacek <polacek@redhat.com>
PR c/61553 PR c/61553
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
typedef void VOID; typedef void VOID;
int foo(void); int foo(void);
int bar(VOID); // { dg-error "type|invalid use" } int bar(VOID);
template<int> int foo(void); template<int> int foo(void);
template<int> int bar(VOID); // { dg-error "type|invalid use" } template<int> int bar(VOID);
struct A struct A
{ {
int foo(void); int foo(void);
int bar(VOID); // { dg-error "type|invalid use" } int bar(VOID);
}; };
// PR c++/33101 // PR c++/33101
typedef void v; typedef void v;
typedef v (*pf)(v); // { dg-error "invalid use of typedef-name" } typedef v (*pf)(v);
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