[llvm-bugs] [Bug 40430] New: constexpr evaluation fails with string init
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 23 16:51:20 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40430
Bug ID: 40430
Summary: constexpr evaluation fails with string init
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: efriedma at codeaurora.org
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
struct S {
char c[10] = "asdf";
constexpr char foo() { return c[3]; }
};
static_assert(S().foo() == 'f', "");
<stdin>:5:15: error: static_assert expression is not an integral constant
expression
static_assert(S().foo() == 'f', "");
^~~~~~~~~~~~~~~~
<stdin>:2:16: note: subexpression not valid in a constant expression
char c[10] = "asdf";
^
<stdin>:5:15: note: in call to 'S()'
static_assert(S().foo() == 'f', "");
^
1 error generated.
Synthetic testcase I came up with looking at the array vs. lvalue confusion in
constant evaluation.
--
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/20190124/3808f522/attachment.html>
More information about the llvm-bugs
mailing list