[LLVMbugs] [Bug 17410] New: Allow reinterpret_cast in constant expression when -fms-compatibility is enabled

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 30 00:39:20 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17410

            Bug ID: 17410
           Summary: Allow reinterpret_cast in constant expression when
                    -fms-compatibility is enabled
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: p_hampson at wargaming.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Currently Clang cannot use the DIJOFS_nnn and similar CPP macros as case labels
as they evaluate to: FIELD_OFFSET(DIJOYSTATE, nnn) which is defined in winnt.h
as:

#define FIELD_OFFSET(type, field)    ((LONG)(LONG_PTR)&(((type *)0)->field))

Clang rejects them with:
error : case value is not a constant expression
note: expanded from macro 'FIELD_OFFSET'
note: cast that performs the conversions of a reinterpret_cast is not allowed
in a constant expression

MinGW's w32api package bounced off the same issue, and resolved it by changing
their definition of FIELD_OFFSET to use offsetof, but that's not a great option
for the upstream headers.

http://sourceforge.net/p/mingw/bugs/693/

-- 
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/20130930/bd2d37c8/attachment.html>


More information about the llvm-bugs mailing list