Tested x86_64-pc-linux-gnu, applying to trunk.
-- 8< --
'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 | 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 2bf71e54045..874530f065d 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 21ee65c3400..e6e24f46196 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>
base-commit: 08a01465d802616256c5dff8d04e16fcb4a3d831
--
2.54.0