re PR c++/51314 ([C++0x] sizeof... and parentheses)

PR c++/51314
	* parser.c (cp_parser_sizeof_operand): Require parentheses for
	sizeof...

From-SVN: r186988
This commit is contained in:
Marc Glisse 2012-04-30 18:36:37 +02:00 committed by Jason Merrill
parent 81b9589421
commit 1941b0ca5b
4 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2012-04-30 Marc Glisse <marc.glisse@inria.fr>
PR c++/51314
* parser.c (cp_parser_sizeof_operand): Require parentheses for
sizeof...
2012-04-30 Dodji Seketeli <dodji@redhat.com>
Fix location for static class members

View File

@ -21969,6 +21969,9 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword)
/*attrlist=*/NULL);
}
}
else if (pack_expansion_p)
permerror (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. */

View File

@ -1,3 +1,9 @@
2012-04-30 Marc Glisse <marc.glisse@inria.fr>
PR c++/51314
* g++.dg/cpp0x/vt-51314.C: New test.
* g++.dg/cpp0x/variadic76.C: Fix.
2012-04-30 Greta Yorsh <Greta.Yorsh@arm.com>
* gcc.dg/pr52283.c: Add missing dg-warning and dg-options.

View File

@ -4,7 +4,8 @@
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 ()