https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124399
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:6d88d6e66e85400ed58bb7e9ad6690f249e319af commit r16-7991-g6d88d6e66e85400ed58bb7e9ad6690f249e319af Author: Jakub Jelinek <[email protected]> Date: Tue Mar 10 21:24:33 2026 +0100 c++: Use complete_type on first annotations_of argument if it is a type [PR124399] The following testcases FAIL (annotations12.C is directly from https://eel.is/c++draft/meta.reflection#annotation-4 ) because it is called on a reflection of class template instantiation which has been just looked up but not yet completed, and in that case it doesn't have any attributes instantiated. Only complete_type instantiates those. Unlike the second argument of annotations_of_with_type where the standard requires is_complete_type, in this case it doesn't, so it is fine if one uses struct S; static_assert (annotations_of (^^S).size () == 0); but I'm afraid we need to instantiate the argument to get the annotations. 2026-03-10 Jakub Jelinek <[email protected]> PR c++/124399 * reflect.cc (eval_annotations_of): Call complete_type on r if it is a type. * g++.dg/reflect/annotations3.C: Uncomment 3 test lines. * g++.dg/reflect/annotations12.C: New test. * g++.dg/reflect/constant_of5.C: Enable some commented out or #if 0ed out tests. * g++.dg/reflect/constant_of6.C: Remove dg-error directive. * g++.dg/reflect/extract6.C: Remove 2 dg-error directives.
