re PR c++/59435 (sizeof...(T) as default value for an argument in the constructor does not work)

/cp
2013-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59435
	* parser.c (cp_parser_cache_defarg): sizeof ... ( p ) can
	occur in a default argument too.

/testsuite
2013-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59435
	* g++.dg/cpp0x/variadic-sizeof3.C: New.

From-SVN: r205836
This commit is contained in:
Paolo Carlini 2013-12-09 22:59:33 +00:00 committed by Paolo Carlini
parent ca0a2d5d0d
commit f0c6059cdc
4 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-12-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59435
* parser.c (cp_parser_cache_defarg): sizeof ... ( p ) can
occur in a default argument too.
2013-12-06 Caroline Tice <cmtice@google.com>
Submitting patch from Stephen Checkoway, s@cs.jhu.edu

View File

@ -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

View File

@ -1,3 +1,8 @@
2013-12-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59435
* g++.dg/cpp0x/variadic-sizeof3.C: New.
2013-12-09 David Malcolm <dmalcolm@redhat.com>
* g++.dg/plugin/selfassign.c (execute_warn_self_assign): Eliminate

View File

@ -0,0 +1,15 @@
// PR c++/59435
// { dg-require-effective-target c++11 }
template <typename... E>
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 <typename... T>
void test(int i = sizeof...(T)) // compile
{}