[llvm-bugs] [Bug 33098] New: Undefined symbol link-time error with std::make_shared and scoped constexpr value

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 18 17:06:09 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33098

            Bug ID: 33098
           Summary: Undefined symbol link-time error with std::make_shared
                    and scoped constexpr value
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marcosatti at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18470
  --> https://bugs.llvm.org/attachment.cgi?id=18470&action=edit
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 at 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 at 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 at 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.

-- 
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/20170519/2ed799fc/attachment.html>


More information about the llvm-bugs mailing list