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

            Bug ID: 93477
           Summary: [10 Regression] __atribute__((weak)) variables sharing
                    the same name in two named namespaces cause a multiple
                    definition error
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimhen at gmail dot com
  Target Milestone: ---

r10-6101 PASS
r10-6221 FAIL

PASS with anonymous namespace.

May be start at r10-6110?

$ cat x.cc
namespace x {
  struct s {
    s() {}
    static int a;
  };
  struct s __attribute__((weak)) b = {};
};

$ g++ -fpic -DPIC x.cc -c -o x.o
$ g++ -fpic -DPIC x.cc -c -o y.o
$ g++ -shared x.o y.o -o z.so
ld: y.o:(.bss+0x8): multiple definition of `guard variable for x::b';
x.o:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status


Fedora 31 x86_64

Reply via email to