Commit f0c6059c by Paolo Carlini Committed by Paolo Carlini

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
parent ca0a2d5d
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> 2013-12-06 Caroline Tice <cmtice@google.com>
Submitting patch from Stephen Checkoway, s@cs.jhu.edu Submitting patch from Stephen Checkoway, s@cs.jhu.edu
......
...@@ -24513,7 +24513,7 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi) ...@@ -24513,7 +24513,7 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi)
case CPP_CLOSE_SQUARE: case CPP_CLOSE_SQUARE:
if (depth == 0 if (depth == 0
/* Handle correctly int n = sizeof ... ( p ); */ /* Handle correctly int n = sizeof ... ( p ); */
&& !(nsdmi && token->type == CPP_ELLIPSIS)) && token->type != CPP_ELLIPSIS)
done = true; done = true;
/* Update DEPTH, if necessary. */ /* Update DEPTH, if necessary. */
else if (token->type == CPP_CLOSE_PAREN else if (token->type == CPP_CLOSE_PAREN
......
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> 2013-12-09 David Malcolm <dmalcolm@redhat.com>
* g++.dg/plugin/selfassign.c (execute_warn_self_assign): Eliminate * g++.dg/plugin/selfassign.c (execute_warn_self_assign): Eliminate
......
// 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
{}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment