c++: subst failure in attribute argument [PR95192]
Another SFINAE issue: we weren't propagating substitution failure in
attributes back up. And tsubst_function_decl needs to check substitution
before register_specialization. I thought about moving the other error
returns up as well, but they aren't SFINAE cases, so they can stay where
they are.
This change caused pr84630.C to stop giving an error; this was because
partial instantiation of the lambda failed silently, and before the change
that meant error_mark_node passed to decl_attributes, which complained about
there being an argument at all. With the change the partial instantiation
fails, but no error was ever given, because push_template_decl silently
failed if current_template_parms wasn't set. So let's set c_t_p
appropriately. lambda-uneval13.C is a valid testcase to exercise this.
gcc/cp/ChangeLog:
PR c++/95192
* pt.c (tsubst_attribute): Handle error.
(apply_late_template_attributes): Return false on error.
(tsubst_function_decl): Check its return value.
(tsubst_decl): Likewise.
(push_template_decl): Assert current_template_parms.
(tsubst_template_decl): Set current_template_parms.
gcc/testsuite/ChangeLog:
PR c++/95192
* g++.dg/cpp0x/pr84630.C: Call b().
* g++.dg/cpp2a/lambda-uneval13.C: New test.
* g++.dg/ext/attr-expr1.C: New test.