https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91701
Bug ID: 91701
Summary: ICE in condiional noexcept on lambda
Product: gcc
Version: 7.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gccbugbjorn at fahller dot se
Target Milestone: ---
This bug looks very similar to bug 79590, but that is supposedly fixed in 7.1
and later. This one still fails in 7.1 through 7.4, but works in 8 and 9.
The following code snippet provokes the ICE:
template <typename T>
auto convert_to = [](auto v) noexcept(noexcept(T(v))) { return T(v);};
auto b = convert_to<bool>(3);
The message is:
t.cpp: In instantiation of 'struct<lambda(auto:1)>':
t.cpp:2:6: required from 'auto convert_to<bool>'
t.cpp:4:10: required from here
t.cpp:2:20: internal compiler error: in nothrow_spec_p, at cp/except.c:1149
auto convert_to = [](auto v) noexcept(noexcept(T(v))) { return T(v);};
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 1
t.cpp: In instantiation of 'struct<lambda(auto:1)>':
t.cpp:2:6: required from 'auto convert_to<bool>'
t.cpp:4:10: required from here
t.cpp:2:20: internal compiler error: in nothrow_spec_p, at cp/except.c:1149
auto convert_to = [](auto v) noexcept(noexcept(T(v))) { return T(v);};
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Execution build compiler returned: 1
See also: https://gcc.godbolt.org/z/lkoZaT