public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106957] New: compiler error when calling lambda in decltype in trailing return type of function templated on T when passing T{} to the lambda
@ 2022-09-16 16:30 enricomaria.dean6elis at gmail dot com
2024-04-13 8:14 ` [Bug c++/106957] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: enricomaria.dean6elis at gmail dot com @ 2022-09-16 16:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106957
Bug ID: 106957
Summary: compiler error when calling lambda in decltype in
trailing return type of function templated on T when
passing T{} to the lambda
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: enricomaria.dean6elis at gmail dot com
Target Milestone: ---
Created attachment 53586
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53586&action=edit
the output/error upon compilation
Repro on godbolt (https://godbolt.org/z/9T5aEnzYa)
Question on stackoverlow with a comment sayint that the code would be illegal
anyway:
https://stackoverflow.com/questions/73747517/sfinae-ing-on-a-nullary-lambda-expression-calling-a-non-templated-function-on-a
Here's the code
```
#include <type_traits>
constexpr auto f = [](int){};
template<typename T>
auto canCallFOn(T) -> decltype([]{ f(T{}); }(), std::true_type{});
constexpr std::false_type canCallFOn(...) {
return {};
}
int main() {
static_assert(!canCallFOn(1));
static_assert(!canCallFOn(""));
}
```
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/106957] compiler error when calling lambda in decltype in trailing return type of function templated on T when passing T{} to the lambda
2022-09-16 16:30 [Bug c++/106957] New: compiler error when calling lambda in decltype in trailing return type of function templated on T when passing T{} to the lambda enricomaria.dean6elis at gmail dot com
@ 2024-04-13 8:14 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13 8:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106957
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-04-13
Ever confirmed|0 |1
Keywords|rejects-valid |error-recovery,
| |ice-on-invalid-code
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-13 8:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 16:30 [Bug c++/106957] New: compiler error when calling lambda in decltype in trailing return type of function templated on T when passing T{} to the lambda enricomaria.dean6elis at gmail dot com
2024-04-13 8:14 ` [Bug c++/106957] " 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).