mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
Don't try to instantiate REFLECT_EXPR_HANDLE of REFLECT_ANNOTATION REFLECT_EXPR.
This commit is contained in:
committed by
Marek Polacek
parent
34e0841e21
commit
d08fb83ec6
@@ -23016,6 +23016,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
|
||||
reflect_kind kind = REFLECT_EXPR_KIND (t);
|
||||
if (TYPE_P (h) || TREE_CODE (h) == NAMESPACE_DECL)
|
||||
h = tsubst (h, args, complain, in_decl);
|
||||
else if (kind == REFLECT_ANNOTATION)
|
||||
/* annotations_of should be called on reflections of already
|
||||
instantiated entities and so no need to tsubst the annotation
|
||||
attribute and we rely on pointer equality of that. */
|
||||
;
|
||||
else
|
||||
{
|
||||
/* [expr.reflect] The id-expression of a reflect-expression is
|
||||
|
||||
16
gcc/testsuite/g++.dg/reflect/annotations8.C
Normal file
16
gcc/testsuite/g++.dg/reflect/annotations8.C
Normal file
@@ -0,0 +1,16 @@
|
||||
// { dg-do compile { target c++26 } }
|
||||
// { dg-additional-options "-freflection" }
|
||||
|
||||
#include <meta>
|
||||
|
||||
struct [[=42]] A {};
|
||||
template <auto I>
|
||||
inline auto b = [] (auto &&x) { x.template operator () <I> (); };
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
auto l = [&] <auto> {};
|
||||
auto w = b <annotations_of (^^A)[0]>;
|
||||
w (l);
|
||||
}
|
||||
Reference in New Issue
Block a user