Anonymous union members within a struct are now properly handled as an unevaluated field in C++11 mode. This fixes PR12866.

llvm-svn: 157784
This commit is contained in:
Aaron Ballman 2012-06-01 00:02:08 +00:00
parent 526772de29
commit a0bc07262b
2 changed files with 14 additions and 1 deletions

View File

@ -115,7 +115,7 @@ static IMAKind ClassifyImplicitMemberAccess(Sema &SemaRef,
NamedDecl *D = *I;
if (D->isCXXInstanceMember()) {
if (dyn_cast<FieldDecl>(D))
if (dyn_cast<FieldDecl>(D) || dyn_cast<IndirectFieldDecl>(D))
isField = true;
CXXRecordDecl *R = cast<CXXRecordDecl>(D->getDeclContext());

View File

@ -0,0 +1,13 @@
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s
namespace PR12866 {
struct bar {
union {
int member;
};
};
void foo( void ) {
(void)sizeof(bar::member);
}
}