[llvm-bugs] [Bug 32115] New: constexpr variable template requires default initialization even though it's not instantiated
llvm-bugs at lists.llvm.org
Wed Mar 1 21:17:31 PST 2017
Bug ID: 32115
Summary: constexpr variable template requires default
initialization even though it's not instantiated
Assignee: unassignedclangbugs at nondot.org
Reporter: arnetheduck at gmail.com
CC: llvm-bugs at lists.llvm.org
clang rejects the following snippet:
template <typename T>
constexpr int kTag;
with the error:
default initialization of an object of const type 'const int'
even thought it's never instantiated - gcc (6.2) accepts the same code.
I'm not sure if gcc or clang is at fault, per the standard, but seems
reasonable that the error should be delayed until instantiation - that would be
consistent with a constexpr function for example that can remain undefined
unless it's actually used.
Eventually, I'm looking to specialize the tag for different type and letting
the compile catch any untagged types.
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-bugs