[llvm-bugs] [Bug 34754] New: static data member "unresolved external symbol" if constexpr is used in its definition
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 27 14:47:39 PDT 2017
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: unassignedclangbugs at nondot.org
Reporter: powerchord at web.de
CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170927/1db817ed/attachment.html>
More information about the llvm-bugs
mailing list