8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv14.C
Marek Polacek defceb206b c++: DR 1722: Make lambda to function pointer conv noexcept [PR90583]
DR 1722 clarifies that the conversion function from lambda to pointer to
function should be noexcept(true).

gcc/cp/ChangeLog:

	PR c++/90583
	DR 1722
	* lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
	as noexcept.

gcc/testsuite/ChangeLog:

	PR c++/90583
	DR 1722
	* g++.dg/cpp0x/lambda/lambda-conv14.C: New test.
2020-09-21 18:13:37 -04:00

11 lines
225 B
C

// PR c++/90583
// DR 1722: Lambda to function pointer conversion should be noexcept.
// { dg-do compile { target c++11 } }
void
foo ()
{
auto l = [](int){ return 42; };
static_assert(noexcept((int (*)(int))(l)), "");
}