<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 - Undefined symbol link-time error with std::make_shared and scoped constexpr value"
href="https://bugs.llvm.org/show_bug.cgi?id=33098">33098</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Undefined symbol link-time error with std::make_shared and scoped constexpr value
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>marcosatti@gmail.com
</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=18470" name="attach_18470" title="Failing source code">attachment 18470</a> <a href="attachment.cgi?id=18470&action=edit" title="Failing source code">[details]</a></span>
Failing source code
Source code attached fails at the linking stage.
>From the output, I can see it is calling make_shared using a reference, not a
constant. Of course, the constexpr is taken out at compile time, and so fails
with undefined reference.
marco@Marco-Laptop-PC:/mnt/c/Shared/Dev/Projects/clangbug$ clang++-5.0
--version
clang version 5.0.0-svn303316-1~exp1 (trunk)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
marco@Marco-Laptop-PC:/mnt/c/Shared/Dev/Projects/clangbug$ clang++-5.0
-std=c++14 main.cpp -o main
/tmp/main-1722a6.o: In function `main':
main.cpp:(.text+0x17): undefined reference to `test::sz'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
marco@Marco-Laptop-PC:/mnt/c/Shared/Dev/Projects/clangbug$
However, using -std=c++1z, the code compiles fine. I have tested -std=c++14
with clang 3.8, 4.0 and 5.0 (all fail), only tested -std=c++1z with 5.0
(works).
It could also be a GCC bug, which I have used to compare against. Using
-std=c++14 works under GCC. (Sorry if it is!)
If it matters, I am running Ubuntu 16.04 under the Windows subsystem for Linux.
Thanks, Marco.</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>