public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107390] New: template-nested lambda type uniqueness
@ 2022-10-25 9:52 development at jordi dot vilar.cat
2022-10-25 9:55 ` [Bug c++/107390] " development at jordi dot vilar.cat
2022-10-25 19:23 ` marxin at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: development at jordi dot vilar.cat @ 2022-10-25 9:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107390
Bug ID: 107390
Summary: template-nested lambda type uniqueness
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: development at jordi dot vilar.cat
Target Milestone: ---
type obtained from a lambda (with c++20 decltype()) nested into a template
(either class o function) is not resolved as a unique type, making this simple
code to fail (compiled with g++-12 -std=c++20):
#include <type_traits>
template<typename> struct test1
{
using type0 = decltype([]{});
using type1 = std::type_identity_t<type0>;
static_assert(std::is_same_v<type0, type1>);
};
template<typename> void test2()
{
using type0 = decltype([]{});
using type1 = std::type_identity_t<type0>;
static_assert(std::is_same_v<type0, type1>);
}
int main(int, char**)
{
test1<void>{};
test2<void>();
}
both static_assert fail identically:
error: static assertion failed
8 | static_assert(std::is_same_v<type0, type1>);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
<source>:8:24: note: 'std::is_same_v<test1<void>::<lambda()>,
test1<void>::<lambda()> >' evaluates to false
<source>:16:24: error: static assertion failed
16 | static_assert(std::is_same_v<type0, type1>);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
<source>:16:24: note: 'std::is_same_v<test2<void>()::<lambda()>,
test2<void>()::<lambda()> >' evaluates to false
This compiles correctly if lambdas are not nested inside a template.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/107390] template-nested lambda type uniqueness
2022-10-25 9:52 [Bug c++/107390] New: template-nested lambda type uniqueness development at jordi dot vilar.cat
@ 2022-10-25 9:55 ` development at jordi dot vilar.cat
2022-10-25 19:23 ` marxin at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: development at jordi dot vilar.cat @ 2022-10-25 9:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107390
Jordi Vilar <development at jordi dot vilar.cat> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |development at jordi dot vilar.cat
--- Comment #1 from Jordi Vilar <development at jordi dot vilar.cat> ---
This same code compiles successflully with clang-14 and mscv-19.x. The
following link to compiler explorer demoes it.
https://godbolt.org/z/a9oqbd8bx
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/107390] template-nested lambda type uniqueness
2022-10-25 9:52 [Bug c++/107390] New: template-nested lambda type uniqueness development at jordi dot vilar.cat
2022-10-25 9:55 ` [Bug c++/107390] " development at jordi dot vilar.cat
@ 2022-10-25 19:23 ` marxin at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-25 19:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107390
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
Last reconfirmed| |2022-10-25
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-25 19:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 9:52 [Bug c++/107390] New: template-nested lambda type uniqueness development at jordi dot vilar.cat
2022-10-25 9:55 ` [Bug c++/107390] " development at jordi dot vilar.cat
2022-10-25 19:23 ` marxin 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).