Commit d4b1d43c by Jason Merrill Committed by Jason Merrill

PR c++/80465 - ICE with generic lambda with noexcept-specifier.

	* lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
	set longer for a generic lambda.

From-SVN: r249322
parent cc14602e
2017-06-16 Jason Merrill <jason@redhat.com> 2017-06-16 Jason Merrill <jason@redhat.com>
PR c++/80465 - ICE with generic lambda with noexcept-specifier.
* lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
set longer for a generic lambda.
PR c++/80614 - Wrong mangling for C++17 noexcept type PR c++/80614 - Wrong mangling for C++17 noexcept type
* mangle.c (write_type): Put the eh spec back on the function type. * mangle.c (write_type): Put the eh spec back on the function type.
......
...@@ -987,6 +987,8 @@ maybe_add_lambda_conv_op (tree type) ...@@ -987,6 +987,8 @@ maybe_add_lambda_conv_op (tree type)
null_pointer_node); null_pointer_node);
if (generic_lambda_p) if (generic_lambda_p)
{ {
++processing_template_decl;
/* Prepare the dependent member call for the static member function /* Prepare the dependent member call for the static member function
'_FUN' and, potentially, prepare another call to be used in a decltype '_FUN' and, potentially, prepare another call to be used in a decltype
return expression for a deduced return call op to allow for simple return expression for a deduced return call op to allow for simple
...@@ -1036,9 +1038,7 @@ maybe_add_lambda_conv_op (tree type) ...@@ -1036,9 +1038,7 @@ maybe_add_lambda_conv_op (tree type)
if (generic_lambda_p) if (generic_lambda_p)
{ {
++processing_template_decl;
tree a = forward_parm (tgt); tree a = forward_parm (tgt);
--processing_template_decl;
CALL_EXPR_ARG (call, ix) = a; CALL_EXPR_ARG (call, ix) = a;
if (decltype_call) if (decltype_call)
...@@ -1062,11 +1062,9 @@ maybe_add_lambda_conv_op (tree type) ...@@ -1062,11 +1062,9 @@ maybe_add_lambda_conv_op (tree type)
{ {
if (decltype_call) if (decltype_call)
{ {
++processing_template_decl;
fn_result = finish_decltype_type fn_result = finish_decltype_type
(decltype_call, /*id_expression_or_member_access_p=*/false, (decltype_call, /*id_expression_or_member_access_p=*/false,
tf_warning_or_error); tf_warning_or_error);
--processing_template_decl;
} }
} }
else else
...@@ -1084,6 +1082,9 @@ maybe_add_lambda_conv_op (tree type) ...@@ -1084,6 +1082,9 @@ maybe_add_lambda_conv_op (tree type)
&& TYPE_NOTHROW_P (TREE_TYPE (callop))) && TYPE_NOTHROW_P (TREE_TYPE (callop)))
stattype = build_exception_variant (stattype, noexcept_true_spec); stattype = build_exception_variant (stattype, noexcept_true_spec);
if (generic_lambda_p)
--processing_template_decl;
/* First build up the conversion op. */ /* First build up the conversion op. */
tree rettype = build_pointer_type (stattype); tree rettype = build_pointer_type (stattype);
......
// PR c++/80465
// { dg-options -std=c++1z }
int foo(...);
int main() {
[](auto a) noexcept(noexcept(foo(a))){}(42);
}
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