<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang fails to compile constexpr with -O0/-O1"
href="https://bugs.llvm.org/show_bug.cgi?id=32926">32926</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang fails to compile constexpr with -O0/-O1
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Vsevolod.Livinskij@frtk.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=18411" name="attach_18411" title="Reproducer.">attachment 18411</a> <a href="attachment.cgi?id=18411&action=edit" title="Reproducer.">[details]</a></span>
Reproducer.
clangc fails to compile constexpr at -O0 and -O2 with -std=c++11 and
-std=c++14.
Reproducer:
<span class="quote">>$ cat repr.cpp </span >
#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:
<span class="quote">>$ clang++ -std=c++11 repr.cpp -O0 ; ./a.out</span >
/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)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>