From e77da14a5383b3ed50a9313545b709cf52261cca Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 30 Jul 2013 22:38:52 +0000 Subject: [PATCH] re PR c++/57673 (pack sizeof ... groups ellipsis with preceding expression) /cp 2013-07-30 Paolo Carlini PR c++/57673 * parser.c (cp_parser_cache_defarg): In an NSDMI don't stop when token->type == CPP_ELLIPSIS. /testsuite 2013-07-30 Paolo Carlini PR c++/57673 * g++.dg/cpp0x/nsdmi-sizeof.C: New. From-SVN: r201354 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/nsdmi-sizeof.C | 7 +++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/nsdmi-sizeof.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0c9dcd6448..cc2cc541c67 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-07-30 Paolo Carlini + + PR c++/57673 + * parser.c (cp_parser_cache_defarg): In an NSDMI don't stop when + token->type == CPP_ELLIPSIS. + 2013-07-30 Paolo Carlini PR c++/57947 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 56a017fdb7e..7f4ad1c7dba 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -24145,7 +24145,9 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi) case CPP_SEMICOLON: case CPP_CLOSE_BRACE: case CPP_CLOSE_SQUARE: - if (depth == 0) + if (depth == 0 + /* Handle correctly int n = sizeof ... ( p ); */ + && !(nsdmi && token->type == CPP_ELLIPSIS)) done = true; /* Update DEPTH, if necessary. */ else if (token->type == CPP_CLOSE_PAREN diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 22e1a1fd7f4..905518d168d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-07-30 Paolo Carlini + + PR c++/57673 + * g++.dg/cpp0x/nsdmi-sizeof.C: New. + 2013-07-30 Steve Ellcey * gcc.target/mips/code-readable-1.c: Increase switch size. diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-sizeof.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-sizeof.C new file mode 100644 index 00000000000..fac979b668d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-sizeof.C @@ -0,0 +1,7 @@ +// PR c++/57673 +// { dg-do compile { target c++11 } } + +template< int ... p > +struct d { + int n = sizeof ... ( p ); +}; -- 2.30.2