[llvm-bugs] [Bug 32926] New: clang fails to compile constexpr with -O0/-O1
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 4 10:48:47 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=32926
Bug ID: 32926
Summary: clang fails to compile constexpr with -O0/-O1
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: Vsevolod.Livinskij at frtk.ru
CC: llvm-bugs at lists.llvm.org
Created attachment 18411
--> https://bugs.llvm.org/attachment.cgi?id=18411&action=edit
Reproducer.
clangc fails to compile constexpr at -O0 and -O2 with -std=c++11 and
-std=c++14.
Reproducer:
>$ cat repr.cpp
#include <iostream>
#include <utility>
template<typename T>
void foo() {
std::cout << T::debug_typeid << std::endl;
std::make_pair(T::debug_typeid, T::debug_typeid);
}
struct A {
static constexpr uint32_t debug_typeid = 1;
};
int main () {
foo<A>();
}
Error:
>$ clang++ -std=c++11 repr.cpp -O0 ; ./a.out
/tmp/repr-ac99cc.o: In function `void foo<A>()':
repr.cpp:(.text._Z3fooI1AEvv[_Z3fooI1AEvv]+0x30): undefined reference to
`A::debug_typeid'
clang-5.0: error: linker command failed with exit code 1 (use -v to see
invocation)
clang version 5.0.0 (trunk 302068)
--
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/20170504/1bfbbe85/attachment-0001.html>
More information about the llvm-bugs
mailing list