[llvm-bugs] [Bug 42222] New: ‘inner’ declared ‘static’ in ‘constexpr’ context
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jun 10 22:25:59 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42222
Bug ID: 42222
Summary: ‘inner’ declared ‘static’ in ‘constexpr’ context
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: zhonghao at pku.org.cn
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
My clang is 9.0.0, and the code is:
struct test { const int *addr; };
const test* setup()
{
static constexpr test atest =
{
({ static const int inner = 123; &inner; })
};
return &atest;
}
int main(){}
clang accepts it, but icc and gcc reject it.
gcc:
source>: In function 'const test* setup()':
<source>:7:22: error: 'inner' declared 'static' in 'constexpr' context
7 | ({ static const int inner = 123; &inner; })
| ^~~~~
Compiler returned: 1
icc:
source>(7): error: expression must have a constant value
({ static const int inner = 123; &inner; })
^
compilation aborted for <source> (code 2)
Compiler returned: 2
--
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/20190611/b982a306/attachment.html>
More information about the llvm-bugs
mailing list