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

            Bug ID: 89878
           Summary: same specializations on a zero-initialized struct
                    object as a non-type parameter treated as distinct
           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: ---

While testing a patch for bug 89833 I noticed that the C++ 2a test case below
is accepted even though it redefines the same function f() three times, each
time taking an argument of the same type: B<A()>, with the only difference
between them being the form of initialization of the non-type parameter.  The
mangling of each of the functions is also distinct when it should be the same.

$ cat u.C && gcc -c -Wall -Wextra -std=c++2a u.C && nm u.o
struct A { int a[3]; };

template <A> struct B { };

void f (B<A{ }>) { }
void f (B<A{ 0 }>) { }
void f (B<A{ 0, 0 }>) { }
void f (B<A{ 0, 0, 0 }>) { }
0000000000000000 T _Z1f1BIXtl1AEEE
0000000000000010 T _Z1f1BIXtl1AtlA3_iLi0EEEEE
0000000000000020 T _Z1f1BIXtl1AtlA3_iLi0ELi0EEEEE
0000000000000030 T _Z1f1BIXtl1AtlA3_iLi0ELi0ELi0EEEEE

Reply via email to