0

I put the following code into two .cpp's, and cross compiled it with clang on Mac to ARM64 architecture. C++14 was used.

template <int>
constexpr bool  Variable = true;

template <>
constexpr bool  Variable<1> = false;

I got the following linker error.

duplicate symbol 'Variable<1>' in:
    Main.cpp.o
    Other.cpp.o
ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Works fine with other compilers, even with clang when targeting x86-64.

Is this a bug in clang?

Dr. Gut
  • 2,053
  • 7
  • 26

0 Answers0