When compiled with gcc 4.1.0 on Linux, the program below causes the assembler
to issue an error complaining about foobar being defined twice. I believe the
program is well-formed and should compile and run successfully to completion
(it does with Intel C++ 10.0 on Linux).

$ cat x.cpp && gcc -dumpversion && gcc x.cpp
namespace N {
  extern "C" {
    extern const int foobar;
    const int foobar = 1;
    struct S { static const int foobar; };
    const int S::foobar = 2;
  }
}
int main () { return !(N::foobar + 1 == N::S::foobar); }

4.1.0
/tmp/ccL0oF3c.s: Assembler messages:
/tmp/ccL0oF3c.s:29: Error: symbol `foobar' is already defined


-- 
           Summary: "C" data and static const data members mangled the same
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33786

Reply via email to