===================================================================
@@ -2,11 +2,12 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
template<int... N> int foo ()
{
- return sizeof... N (); // { dg-error "cannot be used as a function" }
+ return sizeof... (N ()); // { dg-error "cannot be used as a function" }
+ return sizeof... (N) (); // { dg-error "cannot be used as a function" }
}
int bar ()
{
return foo<0> ();
===================================================================
@@ -0,0 +1,15 @@
+// { dg-options "-std=c++11" }
+// { dg-prune-output "invalid" }
+
+template<int>struct A{};
+template<class...U>void f(U...){
+ A<sizeof...U> x; // { dg-error "surrounded by parentheses" }
+}
+
+
+template<int...> struct Indices;
+template<class> struct Next_increasing_indices;
+template<int...I> struct Next_increasing_indices<Indices<I...> > {
+ typedef Indices<I...,sizeof...I> type; // { dg-error "surrounded by parentheses" }
+};
+
Property changes on: testsuite/g++.dg/cpp0x/vt-51314.C
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision URL
===================================================================
@@ -21965,10 +21965,13 @@ cp_parser_sizeof_operand (cp_parser* par
TYPENAME,
/*initialized=*/0,
/*attrlist=*/NULL);
}
}
+ else if (pack_expansion_p)
+ error_at (cp_lexer_peek_token (parser->lexer)->location,
+ "%<sizeof...%> argument must be surrounded by parentheses");
/* If the type-id production did not work out, then we must be
looking at the unary-expression production. */
if (!expr)
expr = cp_parser_unary_expression (parser, /*address_p=*/false,