Hi! I think a USING_STMT operand shouldn't count as consteval-only use.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2026-05-06 Jakub Jelinek <[email protected]> PR c++/125184 * reflect.cc (check_out_of_consteval_use): Ignore USING_STMTs. * g++.dg/reflect/using3.C: New test. --- gcc/cp/reflect.cc.jj 2026-05-05 09:57:59.014541622 +0200 +++ gcc/cp/reflect.cc 2026-05-05 12:29:03.599363151 +0200 @@ -8791,6 +8791,9 @@ check_out_of_consteval_use (tree expr, b if (VAR_P (expr) && DECL_DECLARED_CONSTEXPR_P (expr)) return false; + if (TREE_CODE (expr) == USING_STMT) + return false; + hash_set<tree> pset; if (tree t = cp_walk_tree (&expr, check_out_of_consteval_use_r, &pset, &pset)) { --- gcc/testsuite/g++.dg/reflect/using3.C.jj 2026-05-05 12:29:58.637468773 +0200 +++ gcc/testsuite/g++.dg/reflect/using3.C 2026-05-05 12:30:45.345709765 +0200 @@ -0,0 +1,11 @@ +// PR c++/125184 +// { dg-do compile { target c++26 } } +// { dg-additional-options "-freflection" } + +#include <meta> + +void +foo () +{ + using std::meta::info; +} Jakub
