https://bugs.llvm.org/show_bug.cgi?id=39242
Bug ID: 39242
Summary: accepts-invalid when a constexpr function is called in
a conditional
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++14
Assignee: unassignedclangb...@nondot.org
Reporter: rak...@freebsd.org
CC: llvm-bugs@lists.llvm.org
constexpr bool always_false() { return false; }
int f() { return 1; }
constexpr int g() {
if (!always_false()) {}
return f();
}
The excerpt above fails on GCC and MSVC. clang++ also complains when the
conditional clause is removed:
<source>:3:15: error: constexpr function never produces a constant expression
[-Winvalid-constexpr]
constexpr int g() {
^
<source>:5:10: note: non-constexpr function 'f' cannot be used in a constant
expression
return f();
^
<source>:2:5: note: declared here
int f() { return 1; }
^
--
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