[cfe-commits] r157784 - in /cfe/trunk: lib/Sema/SemaExprMember.cpp test/SemaCXX/anonymous-union-cxx11.cpp
Aaron Ballman
aaron at aaronballman.com
Thu May 31 17:02:08 PDT 2012
Author: aaronballman
Date: Thu May 31 19:02:08 2012
New Revision: 157784
URL: http://llvm.org/viewvc/llvm-project?rev=157784&view=rev
Log:
Anonymous union members within a struct are now properly handled as an unevaluated field in C++11 mode. This fixes PR12866.
Added:
cfe/trunk/test/SemaCXX/anonymous-union-cxx11.cpp
Modified:
cfe/trunk/lib/Sema/SemaExprMember.cpp
Modified: cfe/trunk/lib/Sema/SemaExprMember.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprMember.cpp?rev=157784&r1=157783&r2=157784&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprMember.cpp Thu May 31 19:02:08 2012
@@ -115,7 +115,7 @@
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());
Added: cfe/trunk/test/SemaCXX/anonymous-union-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/anonymous-union-cxx11.cpp?rev=157784&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/anonymous-union-cxx11.cpp (added)
+++ cfe/trunk/test/SemaCXX/anonymous-union-cxx11.cpp Thu May 31 19:02:08 2012
@@ -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);
+ }
+}
More information about the cfe-commits
mailing list