Eliminate an incomplete/incorrect attempt to provide support for C++0x

unrestricted unions, which ended up attempting to initialize objects
in a union (which CodeGen isn't prepared for). Fixes PR9683.

llvm-svn: 135027
This commit is contained in:
Douglas Gregor 2011-07-13 02:14:02 +00:00
parent 609ada27ce
commit d29fde248e
2 changed files with 18 additions and 5 deletions

View File

@ -2190,11 +2190,8 @@ static bool CollectFieldInitializer(Sema &SemaRef, BaseAndFieldInfo &Info,
}
}
// Fallthrough and construct a default initializer for the union as
// a whole, which can call its default constructor if such a thing exists
// (C++0x perhaps). FIXME: It's not clear that this is the correct
// behavior going forward with C++0x, when anonymous unions there are
// finalized, we should revisit this.
// FIXME: C++0x unrestricted unions might call a default constructor here.
return false;
} else {
// For structs, we simply descend through to initialize all members where
// necessary.

View File

@ -114,3 +114,19 @@ template <typename T> struct Foo {
};
};
Foo<int> f;
namespace PR9683 {
struct QueueEntry {
union {
struct {
void* mPtr;
union {
unsigned mSubmissionTag;
};
};
unsigned mValue;
};
QueueEntry() {}
};
QueueEntry QE;
}