[llvm-bugs] [Bug 47046] New: Template member variable is considered not a constexpr
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 7 17:02:41 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47046
Bug ID: 47046
Summary: Template member variable is considered not a constexpr
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++17
Assignee: unassignedclangbugs at nondot.org
Reporter: lev.rumyantsev at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
This code snippets fails to compile with clang (as indicated below) but
successfully compiles with gcc.
https://godbolt.org/z/n8nGM3
=============
template <auto T>
class Object {
template <auto U>
static constexpr bool kTrue = true;
public:
static int Method() {
// error: constexpr if condition is not a constant expression
if constexpr (kTrue<0>) return 0;
return 0;
}
};
int Foo() {
return Object<0>::Method();
}
--
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/20200808/448bf9a0/attachment.html>
More information about the llvm-bugs
mailing list