]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-family: look through non-user-facing typedef [PR124621]
authorJason Merrill <jason@redhat.com>
Mon, 11 May 2026 15:55:06 +0000 (11:55 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 11 May 2026 18:11:55 +0000 (14:11 -0400)
'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.

gcc/c-family/c-common.cc
gcc/testsuite/g++.dg/reflect/reflect_constant_array2.C

index 2bf71e540451cd44ece587725f744afaa549e38d..874530f065d3daa9cd250ff27847eb3c95c87a65 100644 (file)
@@ -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
index 21ee65c340043c0151edcd8668832197f308c07d..e6e24f4619631f3cd1665c55b491eced0a974f09 100644 (file)
@@ -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>