[llvm-bugs] [Bug 32991] New: const variables defined with __delspec(dll export)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 10 09:41:57 PDT 2017


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

            Bug ID: 32991
           Summary: const variables defined with __delspec(dll export)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zahira.ammarguellat at intel.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

In Microsoft C++ mode with microsoft_version >= 1400, const variables defined
in namespace scope, have external linkage by default if the variable was
declared with __declspec(dllexport).

ksh-3.2$ cat test.cpp
__declspec(dllexport) int const x = 3;

ksh-3.2$ cl -c test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cpp

ksh-3.2$ clang -v
clang version 5.0.0 (cfe/trunk 302180)
Target: x86_64-pc-windows-msvc
Thread model: posix

ksh-3.2$ clang -c test.cpp
test.cpp:1:33: error: 'x' must have external linkage when declared 'dllexport'
__declspec(dllexport) int const x = 3;
                                ^
1 error generated.
ksh-3.2$

-- 
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/20170510/a23cfb04/attachment.html>


More information about the llvm-bugs mailing list