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

            Bug ID: 91008
           Summary: error redeclaring the same type involving a non-type
                    template argument
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The three typedefs below all define the same type yet they are rejected.

$ cat t.C && gcc -O2 -c -Wall -Wpedantic -std=c++2a t.C
struct A
{
  constexpr A (int i = 0): i (i + 1) { }
  int i;
};

struct B { A a[2]; };

template <struct B> struct X { };

typedef X<B{ }> XB;
typedef X<B{ 0 }> XB;
typedef X<B{ 0, 0 }> XB;

t.C:12:19: error: conflicting declaration ‘typedef struct X<B{A [2]{A{1},
A{1}}}> XB’
   12 | typedef X<B{ 0 }> XB;
      |                   ^~
t.C:11:17: note: previous declaration as ‘typedef struct X<B{A [2]{A{1}}}> XB’
   11 | typedef X<B{ }> XB;
      |                 ^~
t.C:13:22: error: conflicting declaration ‘typedef struct X<B{A [2]{A{1},
A{1}}}> XB’
   13 | typedef X<B{ 0, 0 }> XB;
      |                      ^~
t.C:11:17: note: previous declaration as ‘typedef struct X<B{A [2]{A{1}}}> XB’
   11 | typedef X<B{ }> XB;
      |                 ^~

Reply via email to