[LLVMbugs] [Bug 11745] New: incorrect class layout with duplicate empty base classes of small nonempty class
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jan 11 11:15:11 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=11745
Bug #: 11745
Summary: incorrect class layout with duplicate empty base
classes of small nonempty class
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: richard-llvm at metafoo.co.uk
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Given:
template<typename T, unsigned> struct X : T {};
struct E {};
struct Test1 : X<E,0>, X<E,1>, X<E,2>, X<E,3> {};
struct Test2 : X<E,0>, X<E,1>, X<E,2>, X<E,3> { char c; };
sizeof(Test1) is 4, as expected, and the E base subobjects all have distinct
addresses. sizeof(Test2) is 1, and the second, third and fourth E base
subobjects lie outside the full-object!
In particular, this static assert fails:
Test2 a[2];
static_assert((E*)(X<E,1>*)&a[0] != (E*)(X<E,0>*)&a[1], "should not happen");
--
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.
More information about the llvm-bugs
mailing list