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

            Bug ID: 124768
           Summary: extern "C" variables in anonymous namespace get
                    mangled in GCC 15
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: harald at gigawatt dot nl
  Target Milestone: ---

namespace { extern "C" int zero; }
int main() { return zero; }
int zero;

With GCC 14, this runs successfully.

With GCC 15, this fails to link:

/cefs/22/22e6cdc013c8541ce3d1548e_consolidated/compilers_c++_x86_gcc_15.2.0/bin/../lib/gcc/x86_64-linux-gnu/15.2.0/../../../../x86_64-linux-gnu/bin/ld:
/tmp/ccYPKQ1p.o: in function `main':
<source>:2:(.text+0x6): undefined reference to `(anonymous namespace)::zero'
collect2: error: ld returned 1 exit status
Execution build compiler returned: 1

https://godbolt.org/z/s6Trocs5s

Reply via email to