[llvm-bugs] [Bug 46670] New: is_constant_evaluated gives wrong result
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jul 10 05:32:15 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46670
Bug ID: 46670
Summary: is_constant_evaluated gives wrong result
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: cgnitash at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
>From https://stackoverflow.com/questions/62822725/ the following program:
#include<type_traits>
struct S { int i; };
constexpr S f() {
return std::is_constant_evaluated() ? S{1} : S{0};
}
int main() {
S s = f();
return s.i;
}
returns 1. f is not manifestly-constant-evaluated in this context, so result
should be 0.
gcc returns 0 correctly. Here's the godbolt link https://godbolt.org/z/84rYxW
--
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/20200710/eee425aa/attachment.html>
More information about the llvm-bugs
mailing list