[llvm-bugs] [Bug 35772] New: Function pointer to __declspec(dllimport) function not constant in /std:c++latest, works in /std:c++14

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 29 05:38:08 PST 2017


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

            Bug ID: 35772
           Summary: Function pointer to __declspec(dllimport) function not
                    constant in /std:c++latest, works in /std:c++14
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jvapen at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Created attachment 19610
  --> https://bugs.llvm.org/attachment.cgi?id=19610&action=edit
Reproduction

The following code compiles with MSVC2015 (/std:c++14), MSVC2017 (/std:c++17),
Clang-cl 5.0 /std:c++14 though fails to compile with Clang-cl 5.0
/std:c++latest (c++17)

__declspec(dllimport) int toInt(int i);

namespace {
    template<int(*T)(int)>
    struct A {};
}

int main(int, char **)
{
   A<toInt> a{};
   return 0;
}

As soon as the __declspec(dllimport) is removed, the code compiles again.
This issue seems to be the only problem we are encountering upgrading to
MSVC2017 (/std:c++17) and keeping Clang-cl as alternative for parsing.

-- 
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/20171229/eede389a/attachment.html>


More information about the llvm-bugs mailing list