re PR c++/63889 (Ice with redundant static in class scope constexpr variable template.)

PR c++/63889
	* pt.c (finish_template_variable): Move from semantics.c.
	Handle multiple template arg levels.  Handle coercion here.
	(lookup_template_variable): Not here.

From-SVN: r220183
This commit is contained in:
Jason Merrill 2015-01-27 14:16:51 -05:00 committed by Jason Merrill
parent 47da0bf6fb
commit 94e54b8d14
4 changed files with 40 additions and 13 deletions

View File

@ -1,3 +1,10 @@
2015-01-27 Jason Merrill <jason@redhat.com>
PR c++/63889
* pt.c (finish_template_variable): Move from semantics.c.
Handle multiple template arg levels. Handle coercion here.
(lookup_template_variable): Not here.
2015-01-23 Jason Merrill <jason@redhat.com>
PR c++/64314

View File

@ -8091,13 +8091,28 @@ tree
lookup_template_variable (tree templ, tree arglist)
{
tree type = unknown_type_node;
tsubst_flags_t complain = tf_warning_or_error;
tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (templ));
arglist = coerce_template_parms (parms, arglist, templ, complain,
/*req_all*/true, /*use_default*/true);
return build2 (TEMPLATE_ID_EXPR, type, templ, arglist);
}
/* Instantiate a variable declaration from a TEMPLATE_ID_EXPR for use. */
tree
finish_template_variable (tree var)
{
tree templ = TREE_OPERAND (var, 0);
tree arglist = TREE_OPERAND (var, 1);
tree tmpl_args = DECL_TI_ARGS (DECL_TEMPLATE_RESULT (templ));
arglist = add_outermost_template_args (tmpl_args, arglist);
tree parms = DECL_TEMPLATE_PARMS (templ);
tsubst_flags_t complain = tf_warning_or_error;
arglist = coerce_innermost_template_parms (parms, arglist, templ, complain,
/*req_all*/true,
/*use_default*/true);
return instantiate_template (templ, arglist, complain);
}
struct pair_fn_data
{

View File

@ -2454,15 +2454,6 @@ finish_call_expr (tree fn, vec<tree, va_gc> **args, bool disallow_virtual,
return result;
}
/* Instantiate a variable declaration from a TEMPLATE_ID_EXPR for use. */
tree
finish_template_variable (tree var)
{
return instantiate_template (TREE_OPERAND (var, 0), TREE_OPERAND (var, 1),
tf_error);
}
/* Finish a call to a postfix increment or decrement or EXPR. (Which
is indicated by CODE, which should be POSTINCREMENT_EXPR or
POSTDECREMENT_EXPR.) */

View File

@ -0,0 +1,14 @@
// PR c++/63889
// { dg-do compile { target c++14 } }
template<class T>
struct A
{
template<class>
static constexpr bool is_ok = true;
template<bool v = is_ok<T>>
A(T) { }
};
A<int> p(42);