From: Paolo Carlini Date: Mon, 9 Dec 2013 22:59:33 +0000 (+0000) Subject: re PR c++/59435 (sizeof...(T) as default value for an argument in the constructor... X-Git-Tag: releases/gcc-4.9.0~2178 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0c6059cdcd8686feb7a3f1cabf6f2f690573a05;p=thirdparty%2Fgcc.git re PR c++/59435 (sizeof...(T) as default value for an argument in the constructor does not work) /cp 2013-12-09 Paolo Carlini PR c++/59435 * parser.c (cp_parser_cache_defarg): sizeof ... ( p ) can occur in a default argument too. /testsuite 2013-12-09 Paolo Carlini PR c++/59435 * g++.dg/cpp0x/variadic-sizeof3.C: New. From-SVN: r205836 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dd33b05945f0..2acc8c7f3f87 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-12-09 Paolo Carlini + + PR c++/59435 + * parser.c (cp_parser_cache_defarg): sizeof ... ( p ) can + occur in a default argument too. + 2013-12-06 Caroline Tice Submitting patch from Stephen Checkoway, s@cs.jhu.edu diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index bd4ead74dc81..063d2ac77c3d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -24513,7 +24513,7 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi) 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ae5983a6fc25..b1b043c1e202 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-12-09 Paolo Carlini + + PR c++/59435 + * g++.dg/cpp0x/variadic-sizeof3.C: New. + 2013-12-09 David Malcolm * g++.dg/plugin/selfassign.c (execute_warn_self_assign): Eliminate diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof3.C b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof3.C new file mode 100644 index 000000000000..7296500a3adc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof3.C @@ -0,0 +1,15 @@ +// PR c++/59435 +// { dg-require-effective-target c++11 } + +template +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 +void test(int i = sizeof...(T)) // compile +{}