https://bugs.llvm.org/show_bug.cgi?id=34754

            Bug ID: 34754
           Summary: static data member "unresolved external symbol" if
                    constexpr is used in its definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangb...@nondot.org
          Reporter: powerch...@web.de
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

// header.h
struct S { static int const i; };

// source.cpp
#include "header.h"
constexpr int const S::i = 0;

// main.cpp
#include "header.h"
int main()
{
return S::i; // error or OK, depending on "C++ Language Standard" in compiler
options
}

If compiled with clang and "ISO C++ Latest Draft Standard (/std:c++latest)":
linker error "unresolved external symbol"

If compiled with clang and "ISO C++17 Standard (/std:c++17)" or "ISO C++14
Standard (/std:c++14)": OK

If compiled with VC: OK in all cases

I'm using Visual Studio 2017 on Windows 10 64-bit and the latest clang for
Windows.
Can someone tell me what's going on here? Is this a bug in clang?
S::i has external linkage, but clang seems to transform it into internal
linkage if constexpr is in the definition. Why?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to