On Sun, Sep 18, 2011 at 4:14 AM, Richard Smith <[email protected]>wrote:
> Author: rsmith > Date: Sun Sep 18 06:14:50 2011 > New Revision: 139996 > > URL: http://llvm.org/viewvc/llvm-project?rev=139996&view=rev > Log: > PR10954: variant members should not be implicitly initialized in > constructors if no > mem-initializer is specified for them, unless an in-class initializer is > specified. > > Modified: > cfe/trunk/lib/Sema/SemaDeclCXX.cpp > cfe/trunk/test/CXX/special/class.init/class.base.init/p8-0x.cpp > > Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=139996&r1=139995&r2=139996&view=diff > > ============================================================================== > --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sun Sep 18 06:14:50 2011 > @@ -2291,6 +2291,11 @@ > return false; > } > > + // Don't build an implicit initializer for union members if none was > + // explicitly specified. > + if (Field->getParent()->isUnion()) > + return false; > + > // Don't try to build an implicit initializer if there were semantic > // errors in any of the initializers (and therefore we might be > // missing some that the user actually wrote). > @@ -2464,17 +2469,6 @@ > continue; > } > > - // If this field is somewhere within an anonymous union, we only > - // initialize it if there's an explicit initializer. > - if (isWithinAnonymousUnion(F)) { > Seems this was the last/only use of isWithinAnonymousUnion & clang is warning about it being unused now: /home/dblaikie/Development/llvm/clean/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp:2338:13:warning: unused function 'isWithinAnonymousUnion' [-Wunused-function] static bool isWithinAnonymousUnion(IndirectFieldDecl *F) { ^ Perhaps you could remove it? > - if (CXXCtorInitializer *Init > - = Info.AllBaseFields.lookup(F->getAnonField())) { > - Info.AllToInit.push_back(Init); > - } > - > - continue; > - } > - > // Initialize each field of an anonymous struct individually. > if (CollectFieldInitializer(*this, Info, F->getAnonField(), F)) > HadError = true; >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
