https://bugs.llvm.org/show_bug.cgi?id=47555
Bug ID: 47555
Summary: Inherited constructor unusable for constexpr static
member of class template
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++17
Assignee: unassignedclangb...@nondot.org
Reporter: feodor.alex...@gmail.com
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
Given the code (godbolt link https://godbolt.org/z/dc1G1W):
struct Storage {
explicit constexpr Storage(int) {}
};
struct Derived : Storage {
using Storage::Storage;
};
// static Derived kInstance{1};
template<typename>
struct Template {
static constexpr Derived kDerived{0};
};
Both clang 10.0.1 and current clang trunk (reported as 12.0.0) on Compiler
Explorer emit the following error:
<source>:13:30: error: constexpr variable 'kDerived' must be initialized by a
constant expression
static constexpr Derived kDerived{0};
^~~~~~~~~~~
<source>:13:30: note: constructor inherited from base class 'Storage' cannot be
used in a constant expression; derived class cannot be implicitly initialized
<source>:6:20: note: declared here
using Storage::Storage;
^
Worth noting, uncommenting the line "static Derived kInstant{1};" or commenting
out "template<typename>" makes code compile.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs