Skip to content

[c++] C++ Frontend lays out superclasses like anonymous bitfields! #476

Closed
@lattner

Description

@lattner
Bugzilla Link 104
Resolution FIXED
Resolved on Mar 06, 2010 13:58
Version 1.0
OS All

Extended Description

In this test (test/Regression/C++Frontend/2003-11-09-ConstructorTypeSafety.cpp.tr):


struct contained {
unsigned X;
contained();
};

struct base {
unsigned A, B;
};

struct derived : public base {
contained _M_value_field;
};

int test() {
derived X;
}

There are lots of type safety problems. For example, the types are compiled to:

    %struct.base = type { uint, uint }
    %struct.contained = type { uint }
    %struct.derived = type { ubyte, ubyte, ubyte, ubyte, ubyte, ubyte,

ubyte, ubyte, %struct.contained }

instead of:
%struct.derived = type { %struct.base, %struct.contained }

Ugh. Of course, this is nuking all of my attempts at working on data-structure
based programs. :(

-Chris

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions