Hi,

I think the issue here is simply that the circumstances mentioned in the existing comment can occur both for an NSDMI and for a default argument. Tested x86_64-linux.

Thanks!
Paolo.

/////////////////////////
/cp
2013-12-09  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/59435
        * parser.c (cp_parser_cache_defarg): sizeof ... ( p ) can
        occur in a default argument too.

/testsuite
2013-12-09  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/59435
        * g++.dg/cpp0x/variadic-sizeof3.C: New.
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 205813)
+++ cp/parser.c (working copy)
@@ -24513,7 +24513,7 @@ cp_parser_cache_defarg (cp_parser *parser, bool ns
        case CPP_CLOSE_SQUARE:
          if (depth == 0
              /* Handle correctly int n = sizeof ... ( p );  */
-             && !(nsdmi && token->type == CPP_ELLIPSIS))
+             && token->type != CPP_ELLIPSIS)
            done = true;
          /* Update DEPTH, if necessary.  */
          else if (token->type == CPP_CLOSE_PAREN
Index: testsuite/g++.dg/cpp0x/variadic-sizeof3.C
===================================================================
--- testsuite/g++.dg/cpp0x/variadic-sizeof3.C   (revision 0)
+++ testsuite/g++.dg/cpp0x/variadic-sizeof3.C   (working copy)
@@ -0,0 +1,15 @@
+// PR c++/59435
+// { dg-require-effective-target c++11 }
+
+template <typename... E>
+struct T
+{
+  T(unsigned int i = sizeof...(E)){} // does not compile
+    
+  static constexpr unsigned int U = sizeof...(E);
+  T(unsigned int j, unsigned int i = U){} //  compile
+};
+
+template <typename... T>
+void test(int i = sizeof...(T)) // compile
+{}

Reply via email to