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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The converse of accepting multiple definitions of the same symbol is that valid
redeclarations of the same symbol are rejected as shown in the test case below:

$ cat z.C && gcc -c -Wall -std=c++2a z.C
struct A1 { char c[5]; };

template <A1> struct B { };

typedef B<A1{ { 'A' } }>              A_A____;
typedef B<A1{ { 'A', 0 } }>           A_AZ___;
typedef B<A1{ { 'A', 0, 0 } }>        A_AZZ__;
typedef B<A1{ { 'A', 0, 0, 0 } }>     A_AZZZ_;
typedef B<A1{ { 'A', 0, 0, 0, 0 } }>  A_AZZZZ;

extern A_A____ same_type_B_A1_A;
extern A_AZ___ same_type_B_A1_A;
extern A_AZZ__ same_type_B_A1_A;
extern A_AZZZ_ same_type_B_A1_A;
extern A_AZZZZ same_type_B_A1_A;
z.C:12:16: error: conflicting declaration ‘A_AZ___ same_type_B_A1_A’
   12 | extern A_AZ___ same_type_B_A1_A;
      |                ^~~~~~~~~~~~~~~~
z.C:11:16: note: previous declaration as ‘A_A____ same_type_B_A1_A’
   11 | extern A_A____ same_type_B_A1_A;
      |                ^~~~~~~~~~~~~~~~
z.C:13:16: error: conflicting declaration ‘A_AZZ__ same_type_B_A1_A’
   13 | extern A_AZZ__ same_type_B_A1_A;
      |                ^~~~~~~~~~~~~~~~
z.C:11:16: note: previous declaration as ‘A_A____ same_type_B_A1_A’
   11 | extern A_A____ same_type_B_A1_A;
      |                ^~~~~~~~~~~~~~~~
z.C:14:16: error: conflicting declaration ‘A_AZZZ_ same_type_B_A1_A’
   14 | extern A_AZZZ_ same_type_B_A1_A;
      |                ^~~~~~~~~~~~~~~~
z.C:11:16: note: previous declaration as ‘A_A____ same_type_B_A1_A’
   11 | extern A_A____ same_type_B_A1_A;
      |                ^~~~~~~~~~~~~~~~
z.C:15:16: error: conflicting declaration ‘A_AZZZZ same_type_B_A1_A’
   15 | extern A_AZZZZ same_type_B_A1_A;
      |                ^~~~~~~~~~~~~~~~
z.C:11:16: note: previous declaration as ‘A_A____ same_type_B_A1_A’
   11 | extern A_A____ same_type_B_A1_A;
      |                ^~~~~~~~~~~~~~~~

Reply via email to