[LLVMbugs] [Bug 24251] New: [ms] clang-cl should apply __declspec() to expression, not type, when it's written in front of the tag keyword

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 24 12:04:42 PDT 2015


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

            Bug ID: 24251
           Summary: [ms] clang-cl should apply __declspec() to expression,
                    not type, when it's written in front of the tag
                    keyword
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When building perl on Windows with clang-cl:

        cl -c -I. -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32
-D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE -DPERLDLL -DPERL_CORE
  -O1 -MD -Zi -DNDEBUG -GL -fp:precise  -DPERL_TEXTMODE_SCRIPTS
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -TP -EHsc -Foperllib.obj perllib.c
clang-cl.exe: warning: argument unused during compilation: '-GL'
In file included from perllib.c:10:
In file included from ..\lib\CORE\perl.h:3060:
In file included from .\win32thread.h:4:
./win32.h(284,25) :  error: 'selectany' can only be applied to data items with
external linkage


That line is:

extern const __declspec(selectany) union { unsigned __int64 __q; double __d; }
__PL_nan_u = { 0x7FF8000000000000UI64 };


If it's written like so, clang-cl accepts it:

union U { unsigned __int64 __q; double __d; };
extern const __declspec(selectany) U __PL_nan_u = { 0x7FF8000000000000UI64 };


I guess cl.exe applies the declspec to __PL_nan_u while we try to apply it to
the type? (Even though it's written before "union", so according to
https://msdn.microsoft.com/en-us/library/dabb5z75.aspx it should apply to the
variable.)

-- 
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/20150724/60dd83e0/attachment.html>


More information about the llvm-bugs mailing list