diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-09-18 13:50:43 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-09-18 13:50:43 -0400 |
commit | 82c2acd0bc4411524a8248fcdce219927d921a71 (patch) | |
tree | 934e416ed00fbdabacd2766bc3001d02379b4b36 /gcc/tree-vectorizer.h | |
parent | fe1ed68000d5e9d41ed48ef1202fd21c8b8c9ff8 (diff) | |
download | gcc-82c2acd0bc4411524a8248fcdce219927d921a71.zip gcc-82c2acd0bc4411524a8248fcdce219927d921a71.tar.gz gcc-82c2acd0bc4411524a8248fcdce219927d921a71.tar.bz2 |
c++: alias of decltype(lambda) is opaque [PR116714, PR107390]
Here for
using type = decltype([]{});
static_assert(is_same_v<type, type>);
we strip the alias ahead of time during template argument coercion
which effectively transforms the template-id into
is_same_v<decltype([]{}), decltype([]{})>
which is wrong because later substitution into the template-id will
produce two new lambdas with distinct types and cause is_same_v to
return false.
This demonstrates that such aliases should be considered opaque (a
notion that we recently introduced in r15-2331-g523836716137d0).
(An alternative solution might be to consider memoizing lambda-expr
substitution rather than always producing a new lambda, but this is
much simpler.)
PR c++/116714
PR c++/107390
gcc/cp/ChangeLog:
* pt.cc (dependent_opaque_alias_p): Also return true for a
decltype(lambda) alias.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/lambda-uneval18.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions