public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106398] New: ICE in finish_expr_stmt at cp/semantics.c:872 for lambda with conditional noexcept against lambda in unevaluated context
@ 2022-07-22 5:06 jbassett271 at gmail dot com
2022-07-22 5:31 ` [Bug c++/106398] " jbassett271 at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jbassett271 at gmail dot com @ 2022-07-22 5:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106398
Bug ID: 106398
Summary: ICE in finish_expr_stmt at cp/semantics.c:872 for
lambda with conditional noexcept against lambda in
unevaluated context
Product: gcc
Version: 12.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jbassett271 at gmail dot com
Target Milestone: ---
This ICEs:
#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);
}
#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);
}
#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);
}
#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);
}
#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);
}
https://godbolt.org/z/hPYP8s9W7
I've seen this ICE on several versions of GCC, including 11.1.0, 10.3.0, and
this 12.1.1.
This is possibly https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105692, but I
don't know enough to deduplicate.
This may be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101043.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/106398] ICE in finish_expr_stmt at cp/semantics.c:872 for lambda with conditional noexcept against lambda in unevaluated context
2022-07-22 5:06 [Bug c++/106398] New: 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
@ 2022-07-22 5:31 ` jbassett271 at gmail dot com
2022-07-22 7:36 ` marxin at gcc dot gnu.org
2024-04-13 8:11 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jbassett271 at gmail dot com @ 2022-07-22 5:31 UTC (permalink / raw)
To: gcc-bugs
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);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/106398] ICE in finish_expr_stmt at cp/semantics.c:872 for lambda with conditional noexcept against lambda in unevaluated context
2022-07-22 5:06 [Bug c++/106398] New: 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
2022-07-22 5:31 ` [Bug c++/106398] " jbassett271 at gmail dot com
@ 2022-07-22 7:36 ` marxin at gcc dot gnu.org
2024-04-13 8:11 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-22 7:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106398
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-07-22
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r9-4045-g0c1e0d63fe0ceabb, it was rejected before the revision
with:
pr106398.c: In function ‘void intersect(const set<T>&, const set<T>&)’:
pr106398.c:13:56: error: lambda-expression in unevaluated context
13 | auto f = [&]<typename T1>(T1&& _1) noexcept(decltype([] {
| ^
pr106398.c:13:47: error: decltype evaluates to ‘<type error>’, which is not a
class or enumeration type
13 | auto f = [&]<typename T1>(T1&& _1) noexcept(decltype([] {
| ^~~~~~~~
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/106398] ICE in finish_expr_stmt at cp/semantics.c:872 for lambda with conditional noexcept against lambda in unevaluated context
2022-07-22 5:06 [Bug c++/106398] New: 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
2022-07-22 5:31 ` [Bug c++/106398] " jbassett271 at gmail dot com
2022-07-22 7:36 ` marxin at gcc dot gnu.org
@ 2024-04-13 8:11 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13 8:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106398
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.
*** This bug has been marked as a duplicate of bug 109241 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-13 8:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-22 5:06 [Bug c++/106398] New: 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
2022-07-22 5:31 ` [Bug c++/106398] " jbassett271 at gmail dot com
2022-07-22 7:36 ` marxin at gcc dot gnu.org
2024-04-13 8:11 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).