https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125108

            Bug ID: 125108
           Summary: [reflection] template_arguments_of gives underlying
                    entity of alias template
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jolly.j.chen at gmail dot com
  Target Milestone: ---

template_arguments_of returns the reflection of the underlying entity of an
alias template A instead of the reflection of A. For example
(https://godbolt.org/z/n17bE3dnq):

   template<typename T> using underlying_alias = T;
   template<typename T> using alias = underlying_alias<T>;
   template <template <class> class> struct Test

   static_assert(^^alias != ^^underlying_alias);
   static_assert(template_arguments_of(^^Test<alias>)[0] == ^^alias);

fails with 

   error: static assertion failed
       19 | static_assert(template_arguments_of(^^Test<alias>)[0] == ^^alias);
          • the comparison reduces to '(^^underlying_alias == ^^alias)'

I believe https://eel.is/c++draft/meta.reflection#queries-59.2 states that
template_arguments_of should return ^^alias here. This is also what Clang does.

Reply via email to