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

            Bug ID: 122169
           Summary: is_same_v<const T,const int> with T=int is false
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eczbek.void at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/8z7e1cG9z
Clang accepts this



template<typename... Ts>
void f() {
        using T = Ts...[0];
        static_assert(std::is_same_v<T, int>);
        static_assert(std::is_same_v<const T, const int>);
}

int main() {
        f<int>();
}



<source>: In instantiation of 'void f() [with Ts = {int}]':
required from here
<source>:11:8:   
   11 |         f<int>();
      |         ~~~~~~^~
<source>:7:28: error: static assertion failed
    7 |         static_assert(std::is_same_v<const T, const int>);
      |                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • 'int' is not the same as 'const int'
Compiler returned: 1

Reply via email to