http://llvm.org/bugs/show_bug.cgi?id=8836
Summary: Microsoft's offsetof not recognized as constant
expression
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
The following code uses definition of offsetof from MSVS 9 2008 stddef.h:
// This is from stddef.h
#define offsetof(s,m) (unsigned)&reinterpret_cast<const volatile char&>((((s
*)0)->m))
struct B { char _; long long a; };
int a[ offsetof(B, a) == 8 ? 1 : 2 ];
This fails to parse with message:
u:\kernel\kernel2.cpp(7) : error: variable length array declaration not
allowed at file scope
int a[ offsetof(B, a) == 8 ? 1 : 2 ];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
VC9 is able to compile it.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs