public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112273] New: gcc crashs when checking satisfaction a constraint of lambda function
@ 2023-10-29 12:01 rungecc at gmail dot com
2023-10-29 16:25 ` [Bug c++/112273] gcc crashs when checking satisfaction a constraint of lambda function and using decltype of a variable argument template pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: rungecc at gmail dot com @ 2023-10-29 12:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112273
Bug ID: 112273
Summary: gcc crashs when checking satisfaction a constraint of
lambda function
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rungecc at gmail dot com
Target Milestone: ---
Created attachment 56468
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56468&action=edit
ICE output
```c++
template <class... Ts> struct Tp {};
template <class... T> struct make_delayed {
static constexpr inline bool value = true;
};
template <class... T>
concept K = make_delayed<T...>::value;
[[maybe_unused]] constexpr auto ice(auto... arg) {
using Tp_t = Tp<decltype(arg)...>;
return []()
requires K<Tp_t>
{ return 1; };
};
int main() {
constexpr auto l = ice(1, 2);
static_assert(l() == 1);
return 0;
}
```
See also [online compiler](https://godbolt.org/z/r8K4bK199).
Gcc (checked version 14.0, 13.2, 12.3) with flag `-std=c++2b` crashed on the
above code snippets.
Output, see the attachment.
**NOTE**:
Seems we need 1) a dependent constraint attached to some function and 2) such
constraint refers to a type contains a (dependent) pack expansion in it's
definition to trigger this ICE.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/112273] gcc crashs when checking satisfaction a constraint of lambda function and using decltype of a variable argument template
2023-10-29 12:01 [Bug c++/112273] New: gcc crashs when checking satisfaction a constraint of lambda function rungecc at gmail dot com
@ 2023-10-29 16:25 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-29 16:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112273
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-10-29
Summary|gcc crashs when checking |gcc crashs when checking
|satisfaction a constraint |satisfaction a constraint
|of lambda function |of lambda function and
| |using decltype of a
| |variable argument template
Status|UNCONFIRMED |NEW
Keywords| |c++-lambda
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, slightly reduced/changed:
```
template <class... Ts> struct Tp {};
template <class T> struct make_delayed {
static constexpr inline bool value = true;
};
template <class T>
concept K = make_delayed<T>::value;
template<typename ...t>
constexpr auto ice(t... arg) {
using Tp_t = Tp<decltype(arg)...>;
return []() requires K<Tp_t>
{ return 1; };
};
int main() {
constexpr auto l = ice(1);
static_assert(l() == 1);
return 0;
}
```
If I replace `decltype(arg)` with `t`, GCC no longer ICEs. This is why I moved
away from using auto here to show a case where it is working correctly.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-29 16:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-29 12:01 [Bug c++/112273] New: gcc crashs when checking satisfaction a constraint of lambda function rungecc at gmail dot com
2023-10-29 16:25 ` [Bug c++/112273] gcc crashs when checking satisfaction a constraint of lambda function and using decltype of a variable argument template 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).