[llvm-bugs] [Bug 37918] New: When compiling with `-fopenmp` clang will under certain circumstances not produce symbols for const or constexpr static data members.
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jun 24 13:14:16 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37918
Bug ID: 37918
Summary: When compiling with `-fopenmp` clang will under
certain circumstances not produce symbols for const or
constexpr static data members.
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: chris at detrino.org
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
This seems to happen when the following is true:
- A const or constexpr static data member is declared in a class.
- The data member is ODR-used before its definition is seen.
- The TU is compiled with `-fopenmp`
- This all happens in the global namespace.
A reduced test-case:
// Section A - Define a class with a static constexpr data member.
struct Foo {
static constexpr int bar = 1;
};
// Section B - ODR-use the data member.
void F(const int&);
void Test() { F(Foo::bar); }
// Section C - Define the data member.
constexpr int Foo::bar;
In this example, the `Foo::bar` symbol will not be produced in the output
.s/.o. This can be worked around by moving `Section C` before `Section B`. See
https://godbolt.org/g/LrzUvY for a live demo.
--
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/20180624/aed09501/attachment.html>
More information about the llvm-bugs
mailing list