Hi,

On 06/15/2014 03:37 PM, Jason Merrill wrote:
On 06/15/2014 01:01 AM, Paolo Carlini wrote:
Committed... but, I don't think we are done yet, because it seems to me
that DR577 means that in C++11 mode we have to accept the typedef?!?
Hmm, apparently so.  Might as well apply the DR to C++98 mode as well.
I think the below would be most of it. Today, however, I did some archeology, noticed that we would essentially revert to pre-PR9278 behavior (thus, per its audit trail, make again unhappy some people in the template metaprogramming world?!? Was that known to Core when DR577 got resolved?) and that, fwiw, neither current clang nor current ICC appear to implement DR577 in full. Please double check those sides of the issue... personally I don't have a strong opinion...

Thanks!
Paolo.

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

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

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

        PR c++/33101
        * g++.dg/other/void1.C: Adjust.
        * g++.dg/other/void3.C: Likewise.
Index: cp/decl.c
===================================================================
--- cp/decl.c   (revision 211872)
+++ cp/decl.c   (working copy)
@@ -11138,16 +11138,13 @@ grokparms (tree parmlist, tree *parms)
       type = TREE_TYPE (decl);
       if (VOID_TYPE_P (type))
        {
-         if (type == void_type_node
+         if (same_type_p (type, void_type_node)
              && !init
              && !DECL_NAME (decl) && !result
              && 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;
-         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))
            error_at (DECL_SOURCE_LOCATION (decl),
                      "invalid use of cv-qualified type %qT in "
Index: testsuite/g++.dg/other/void1.C
===================================================================
--- testsuite/g++.dg/other/void1.C      (revision 211872)
+++ testsuite/g++.dg/other/void1.C      (working copy)
@@ -4,13 +4,13 @@
 typedef void VOID;
 
 int foo(void);
-int bar(VOID);                // { dg-error "type|invalid use" }
+int bar(VOID);
 
 template<int> int foo(void);
-template<int> int bar(VOID);  // { dg-error "type|invalid use" }
+template<int> int bar(VOID);
 
 struct A
 {
   int foo(void);
-  int bar(VOID);              // { dg-error "type|invalid use" }
+  int bar(VOID);
 };
Index: testsuite/g++.dg/other/void3.C
===================================================================
--- testsuite/g++.dg/other/void3.C      (revision 211872)
+++ testsuite/g++.dg/other/void3.C      (working copy)
@@ -1,4 +1,4 @@
 // PR c++/33101
 
 typedef void v;
-typedef v (*pf)(v);  // { dg-error "invalid use of typedef-name" }
+typedef v (*pf)(v);

Reply via email to