[Bug c++/106398] ICE in finish_expr_stmt at cp/semantics.c:872 for lambda with conditional noexcept against lambda in unevaluated context
jbassett271 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 22 05:31:09 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106398
--- Comment #1 from Justin Bassett <jbassett271 at gmail dot com> ---
Sorry about the repetition of the code example. That was some kind of bug in
the website or browser where the pasted text did not show up except for the
last copy. Let's give that code snippet one more time to make it more clearly
delineated:
#define FWD(...) static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)
template <bool B>
struct bool_t { static constexpr bool value = B; };
template <typename T>
struct set {
bool contains(T const&) const { return true; }
};
template <typename T>
void intersect(set<T> const& lhs, set<T> const& rhs) {
auto f = [&]<typename T1>(T1&& _1) noexcept(decltype([] {
return bool_t<noexcept(rhs.contains(_1))>{};
}(FWD(_1)))::value) {
return rhs.contains(_1);
};
f(1);
}
int main()
{
set<int> a, b;
intersect(a, b);
}
More information about the Gcc-bugs
mailing list