[llvm-bugs] [Bug 37232] New: clang-cl fails on reference to static constexpr member

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 25 04:42:23 PDT 2018


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

            Bug ID: 37232
           Summary: clang-cl fails on reference to static constexpr member
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: steveire at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The following fails to link:

    template<typename T>
    struct A
    {
        static constexpr int binary = 2;
    };

    class __declspec(dllimport) Exporter
        : public A<int>
    {   

    };

    void takeRef(const int& _Args)
    {  

    }

    int main()
    {
      takeRef(A<int>::binary);

      return 1;
    }

With the message:

    simplemain.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) public: static int const A<int> ::binary"



This is a simplification of a smaller failing testcase:


    #include <fstream>
    #include <memory>

    int main()
    {
      std::make_shared<std::ifstream>("test.txt", std::ios::binary);
      return 1;
    }

-- 
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/20180425/6c7e3710/attachment.html>


More information about the llvm-bugs mailing list