[llvm-bugs] [Bug 33090] New: Link error with make_shared and scoped constant expression

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 18 07:08:19 PDT 2017


            Bug ID: 33090
           Summary: Link error with make_shared and scoped constant
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: marcosatti at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18465
  --> https://bugs.llvm.org/attachment.cgi?id=18465&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
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. Sorry if this is not a
linker bug but a clang bug.

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/20170518/eb4d83b1/attachment.html>

More information about the llvm-bugs mailing list