diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2012-04-30 18:36:37 +0200 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2012-04-30 12:36:37 -0400 |
commit | 1941b0ca5b772c73ff39bece36111e25ee83df7a (patch) | |
tree | 67e0826435a6a342f04d513d1eb3e8f621dca8ad | |
parent | 81b9589421788a06088f1a703100328800e9e9ec (diff) | |
download | gcc-1941b0ca5b772c73ff39bece36111e25ee83df7a.zip gcc-1941b0ca5b772c73ff39bece36111e25ee83df7a.tar.gz gcc-1941b0ca5b772c73ff39bece36111e25ee83df7a.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/variadic76.C | 3 |
4 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8d99c17..282912a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f0f7e98..8fcbba6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7f895fd..6613970 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic76.C b/gcc/testsuite/g++.dg/cpp0x/variadic76.C index a9f8eab..fb80244 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic76.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic76.C @@ -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 () |