https://gcc.gnu.org/g:d3b2edb2664893cc0deb3d8815effa27436b39f9
commit r17-451-gd3b2edb2664893cc0deb3d8815effa27436b39f9 Author: Jason Merrill <[email protected]> Date: Mon May 11 11:55:06 2026 -0400 c-family: look through non-user-facing typedef [PR124621] 'aka' printing shouldn't differ between in-tree and installed compilers due to difference in whether libstdc++ headers are considered to be system headers. The problem was that if we encounter a non-user-facing typedef like __iter_type<T>, we stopped there instead of continuing to look through typedefs to find the underlying user type. PR c++/124621 gcc/c-family/ChangeLog: * c-common.cc (user_facing_original_type_p): Recurse. gcc/testsuite/ChangeLog: * g++.dg/reflect/reflect_constant_array2.C: Add -D_GLIBCXX_SYSHDR. Diff: --- gcc/c-family/c-common.cc | 3 +++ gcc/testsuite/g++.dg/reflect/reflect_constant_array2.C | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index 2bf71e540451..874530f065d3 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -9066,6 +9066,9 @@ user_facing_original_type_p (const_tree type) if (!name_reserved_for_implementation_p (IDENTIFIER_POINTER (orig_id))) return true; + if (typedef_variant_p (orig_type)) + return user_facing_original_type_p (orig_type); + switch (TREE_CODE (orig_type)) { /* Don't look through to an anonymous vector type, since the syntax diff --git a/gcc/testsuite/g++.dg/reflect/reflect_constant_array2.C b/gcc/testsuite/g++.dg/reflect/reflect_constant_array2.C index 21ee65c34004..e6e24f461963 100644 --- a/gcc/testsuite/g++.dg/reflect/reflect_constant_array2.C +++ b/gcc/testsuite/g++.dg/reflect/reflect_constant_array2.C @@ -1,5 +1,6 @@ // { dg-do compile { target c++26 } } -// { dg-additional-options "-freflection" } +// Added _GLIBCXX_SYSHR to test c++/124621. +// { dg-additional-options "-freflection -D_GLIBCXX_SYSHDR" } // Test std::meta::reflect_constant_string. #include <meta>
