]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Fix up is_type_alias2.C testcase for Solaris [PR124119]
authorJakub Jelinek <jakub@redhat.com>
Tue, 17 Feb 2026 08:00:08 +0000 (09:00 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 17 Feb 2026 08:00:08 +0000 (09:00 +0100)
Given https://eel.is/c++draft/expr.reflect#5.1
we error on
typedef __SIZE_TYPE__ A;
namespace B {
  using ::A;
  typedef __SIZE_TYPE__ C;
}
using B::C;
constexpr auto a = ^^A;
constexpr auto b = ^^B::A;
constexpr auto c = ^^B::C;
constexpr auto d = ^^C;
on ^^B::A and ^^C (note, clang++ fork only errors on ^^B::A).
Now, whether size_t is
typedef __SIZE_TYPE__ size_t;
namespace std {
  using ::size_t;
}
or
namespace std {
  typedef __SIZE_TYPE__ size_t;
}
using std::size_t;
depends on the target and clearly is the latter on Solaris, so testing
whether ^^size_t is a type alias doesn't work there - it is found as
a using decl there.
So  the following patch stops testing it for size_t and tests yet another
user alias (a typedef is already tested - ^^T).

2026-02-17  Jakub Jelinek  <jakub@redhat.com>

PR c++/124119
* g++.dg/reflect/is_type_alias2.C (W): New type alias.
Assert is_type_alias (^^W).  Don't assert is_type_alias (^^size_t).

gcc/testsuite/g++.dg/reflect/is_type_alias2.C

index 0fa0a46868c9b854ce030f91afe2a74c1d66de47..82cff34bc0c0787ddd39455db6e78314248502cf 100644 (file)
@@ -15,6 +15,7 @@ template<typename T>
 using V = S<T*>;
 
 typedef int T;
+using W = decltype (sizeof (0));
 
 static_assert (!is_type_alias (^^S<int>));
 static_assert (is_type_alias (^^U));
@@ -22,7 +23,7 @@ static_assert (!is_type_alias (^^V));
 static_assert (is_type_alias (^^V<int>));
 static_assert (is_type_alias (^^T));
 static_assert (!is_type_alias (^^wchar_t));
-static_assert (is_type_alias (^^size_t));
+static_assert (is_type_alias (^^W));
 
 using A = void(int, int);
 static_assert (is_type_alias (^^A));