PR c++/79294 - ICE with invalid template argument
* pt.c (convert_nontype_argument_function): Check value-dependence. (convert_nontype_argument): Don't check it here for function ptrs. From-SVN: r245168
This commit is contained in:
parent
10613537a9
commit
99be38ec6a
3 changed files with 16 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2017-02-03 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/79294 - ICE with invalid template argument
|
||||
* pt.c (convert_nontype_argument_function): Check value-dependence.
|
||||
(convert_nontype_argument): Don't check it here for function ptrs.
|
||||
|
||||
2017-02-02 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR cp/14179
|
||||
|
|
|
@ -5966,6 +5966,9 @@ convert_nontype_argument_function (tree type, tree expr,
|
|||
if (fn == error_mark_node)
|
||||
return error_mark_node;
|
||||
|
||||
if (value_dependent_expression_p (fn))
|
||||
return fn;
|
||||
|
||||
fn_no_ptr = strip_fnptr_conv (fn);
|
||||
if (TREE_CODE (fn_no_ptr) == ADDR_EXPR)
|
||||
fn_no_ptr = TREE_OPERAND (fn_no_ptr, 0);
|
||||
|
@ -6698,8 +6701,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
|
|||
/* Null pointer values are OK in C++11. */
|
||||
return perform_qualification_conversions (type, expr);
|
||||
|
||||
if (!value_dependent_expression_p (expr))
|
||||
expr = convert_nontype_argument_function (type, expr, complain);
|
||||
expr = convert_nontype_argument_function (type, expr, complain);
|
||||
if (!expr || expr == error_mark_node)
|
||||
return expr;
|
||||
}
|
||||
|
@ -6723,8 +6725,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
|
|||
return NULL_TREE;
|
||||
}
|
||||
|
||||
if (!value_dependent_expression_p (expr))
|
||||
expr = convert_nontype_argument_function (type, expr, complain);
|
||||
expr = convert_nontype_argument_function (type, expr, complain);
|
||||
if (!expr || expr == error_mark_node)
|
||||
return expr;
|
||||
}
|
||||
|
|
5
gcc/testsuite/g++.dg/template/error57.C
Normal file
5
gcc/testsuite/g++.dg/template/error57.C
Normal file
|
@ -0,0 +1,5 @@
|
|||
// PR c++/79294
|
||||
|
||||
template <int()> struct a;
|
||||
template <int(b)> a < b // { dg-error "int" }
|
||||
// { dg-error "expected" "" { target *-*-* } .-1 }
|
Loading…
Add table
Reference in a new issue