r269398 - Add support for derived class special members hiding functions brought in from
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Mon May 16 04:02:42 PDT 2016
The reduced reproducer: https://llvm.org/bugs/show_bug.cgi?id=27754
On 14/05/16 01:23, Richard Smith wrote:
> Update: Vassil and I have dug into this a bit offline. It looks like
> the root cause is a likely-pre-existing bug where we somehow import a
> default constructor for a class from a module but don't set the "has a
> default constructor" flag on the class definition.
>
> On Fri, May 13, 2016 at 2:54 AM, Vassil Vassilev
> <v.g.vassilev at gmail.com <mailto:v.g.vassilev at gmail.com>> wrote:
>
> Hi Richard,
> I believe this broke our modules builds. Last successful one was
> with r269388 and the current with r269389 fails with:
>
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/type_traits:69:12: error: constructor cannot be redeclared
> struct integral_constant
> ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/type_traits:69:12: note: previous implicit declaration is here
> struct integral_constant
> ^
> /mnt/build/workspace/root-nightly-master-cxxmodules/BUILDTYPE/Release/COMPILER/native/LABEL/sft-fedora-1/clang_build_269398/ROOT/src/core/meta/src/TGenericClassInfo.cxx:18:10: fatal error: could not build module 'TCollectionProxyInfo.h'
> #include "TCollectionProxyInfo.h"
> ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> 2 errors generated.
>
> and
>
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/new:99:10: error: multiple overloads of 'nothrow_t' instantiate to the same signature 'void ()'
> struct nothrow_t { };
> ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/alloc_traits.h:253:8: note: in instantiation of function template specialization '__gnu_cxx::new_allocator<std::pair<int, int> >::construct<std::pair<int, int>, const std::pair<int, int> &>' requested here
> { __a.construct(__p, std::forward<_Args>(__args)...); }
> ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/alloc_traits.h:399:4: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<std::pair<int, int> > >::_S_construct<std::pair<int, int>, const std::pair<int, int> &>' requested here
> { _S_construct(__a, __p, std::forward<_Args>(__args)...); }
> ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/stl_vector.h:917:21: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<std::pair<int, int> > >::construct<std::pair<int, int>, const std::pair<int, int> &>' requested here
> _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
> ^
> /mnt/build/workspace/root-nightly-master-cxxmodules/BUILDTYPE/Release/COMPILER/native/LABEL/sft-fedora-1/clang_build_269398/ROOT/src/core/meta/src/TSchemaRule.cxx:873:21: note: in instantiation of member function 'std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >::push_back' requested here
> fVersionVect->push_back( verpair );
> ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/new:99:10: note: previous implicit declaration is here
> struct nothrow_t { };
>
> Shall I start reducing the issues one by one or we can revert this
> patch? Vassil On 13/05/16 08:47, Richard Smith via cfe-commits wrote:
>> Author: rsmith
>> Date: Fri May 13 01:47:56 2016
>> New Revision: 269398
>>
>> URL:http://llvm.org/viewvc/llvm-project?rev=269398&view=rev
>> Log:
>> Add support for derived class special members hiding functions brought in from
>> a base class via a using-declaration. If a class has a using-declaration
>> declaring either a constructor or an assignment operator, eagerly declare its
>> special members in case they need to displace a shadow declaration from a
>> using-declaration.
>>
>> Modified:
>> cfe/trunk/include/clang/AST/DeclCXX.h
>> cfe/trunk/include/clang/Sema/Sema.h
>> cfe/trunk/lib/AST/ASTImporter.cpp
>> cfe/trunk/lib/AST/DeclCXX.cpp
>> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>> cfe/trunk/lib/Serialization/ASTWriter.cpp
>> cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp
>> cfe/trunk/test/SemaCUDA/implicit-member-target.cu <http://implicit-member-target.cu>
>> cfe/trunk/test/SemaCXX/constructor-recovery.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/DeclCXX.h
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/DeclCXX.h (original)
>> +++ cfe/trunk/include/clang/AST/DeclCXX.h Fri May 13 01:47:56 2016
>> @@ -382,6 +382,14 @@ class CXXRecordDecl : public RecordDecl
>> /// provided default ctor also doesn't have an in-class initializer.
>> unsigned HasUninitializedFields : 1;
>>
>> + /// \brief True if there are any member using-declarations that inherit
>> + /// constructors from a base class.
>> + unsigned HasInheritedConstructor : 1;
>> +
>> + /// \brief True if there are any member using-declarations named
>> + /// 'operator='.
>> + unsigned HasInheritedAssignment : 1;
>> +
>> /// \brief These flags are \c true if a defaulted corresponding special
>> /// member can't be fully analyzed without performing overload resolution.
>> /// @{
>> @@ -1308,6 +1316,18 @@ public:
>> return data().HasNonLiteralTypeFieldsOrBases;
>> }
>>
>> + /// \brief Determine whether this class has a using-declaration that names
>> + /// a base class constructor.
>> + bool hasInheritedConstructor() const {
>> + return data().HasInheritedConstructor;
>> + }
>> +
>> + /// \brief Determine whether this class has a using-declaration that names
>> + /// a base class assignment operator.
>> + bool hasInheritedAssignment() const {
>> + return data().HasInheritedAssignment;
>> + }
>> +
>> /// \brief Determine whether this class is considered trivially copyable per
>> /// (C++11 [class]p6).
>> bool isTriviallyCopyable() const;
>>
>> Modified: cfe/trunk/include/clang/Sema/Sema.h
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Sema/Sema.h (original)
>> +++ cfe/trunk/include/clang/Sema/Sema.h Fri May 13 01:47:56 2016
>> @@ -4540,6 +4540,9 @@ public:
>> /// class.
>> void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class);
>>
>> + /// \brief Check a completed declaration of an implicit special member.
>> + void CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD);
>> +
>> /// \brief Determine whether the given function is an implicitly-deleted
>> /// special member function.
>> bool isImplicitlyDeleted(FunctionDecl *FD);
>>
>> Modified: cfe/trunk/lib/AST/ASTImporter.cpp
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/ASTImporter.cpp (original)
>> +++ cfe/trunk/lib/AST/ASTImporter.cpp Fri May 13 01:47:56 2016
>> @@ -2115,6 +2115,8 @@ bool ASTNodeImporter::ImportDefinition(R
>> ToData.HasUninitializedReferenceMember
>> = FromData.HasUninitializedReferenceMember;
>> ToData.HasUninitializedFields = FromData.HasUninitializedFields;
>> + ToData.HasInheritedConstructor = FromData.HasInheritedConstructor;
>> + ToData.HasInheritedAssignment = FromData.HasInheritedAssignment;
>> ToData.NeedOverloadResolutionForMoveConstructor
>> = FromData.NeedOverloadResolutionForMoveConstructor;
>> ToData.NeedOverloadResolutionForMoveAssignment
>>
>> Modified: cfe/trunk/lib/AST/DeclCXX.cpp
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/DeclCXX.cpp (original)
>> +++ cfe/trunk/lib/AST/DeclCXX.cpp Fri May 13 01:47:56 2016
>> @@ -53,6 +53,7 @@ CXXRecordDecl::DefinitionData::Definitio
>> HasPublicFields(false), HasMutableFields(false), HasVariantMembers(false),
>> HasOnlyCMembers(true), HasInClassInitializer(false),
>> HasUninitializedReferenceMember(false), HasUninitializedFields(false),
>> + HasInheritedConstructor(false), HasInheritedAssignment(false),
>> NeedOverloadResolutionForMoveConstructor(false),
>> NeedOverloadResolutionForMoveAssignment(false),
>> NeedOverloadResolutionForDestructor(false),
>> @@ -955,6 +956,15 @@ void CXXRecordDecl::addedMember(Decl *D)
>> data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
>> }
>> }
>> +
>> + if (UsingDecl *Using = dyn_cast<UsingDecl>(D)) {
>> + if (Using->getDeclName().getNameKind() ==
>> + DeclarationName::CXXConstructorName)
>> + data().HasInheritedConstructor = true;
>> +
>> + if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
>> + data().HasInheritedAssignment = true;
>> + }
>> }
>>
>> void CXXRecordDecl::finishedDefaultedOrDeletedMember(CXXMethodDecl *D) {
>>
>> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri May 13 01:47:56 2016
>> @@ -6455,20 +6455,28 @@ void Sema::AddImplicitlyDeclaredMembersT
>> if (!ClassDecl->hasUserDeclaredConstructor())
>> ++ASTContext::NumImplicitDefaultConstructors;
>>
>> + // If this class inherited any constructors, declare the default constructor
>> + // now in case it displaces one from a base class.
>> + if (ClassDecl->needsImplicitDefaultConstructor() &&
>> + ClassDecl->hasInheritedConstructor())
>> + DeclareImplicitDefaultConstructor(ClassDecl);
>> +
>> if (!ClassDecl->hasUserDeclaredCopyConstructor()) {
>> ++ASTContext::NumImplicitCopyConstructors;
>>
>> // If the properties or semantics of the copy constructor couldn't be
>> // determined while the class was being declared, force a declaration
>> // of it now.
>> - if (ClassDecl->needsOverloadResolutionForCopyConstructor())
>> + if (ClassDecl->needsOverloadResolutionForCopyConstructor() ||
>> + ClassDecl->hasInheritedConstructor())
>> DeclareImplicitCopyConstructor(ClassDecl);
>> }
>>
>> if (getLangOpts().CPlusPlus11 && ClassDecl->needsImplicitMoveConstructor()) {
>> ++ASTContext::NumImplicitMoveConstructors;
>>
>> - if (ClassDecl->needsOverloadResolutionForMoveConstructor())
>> + if (ClassDecl->needsOverloadResolutionForMoveConstructor() ||
>> + ClassDecl->hasInheritedConstructor())
>> DeclareImplicitMoveConstructor(ClassDecl);
>> }
>>
>> @@ -6480,7 +6488,8 @@ void Sema::AddImplicitlyDeclaredMembersT
>> // it shows up in the right place in the vtable and that we diagnose
>> // problems with the implicit exception specification.
>> if (ClassDecl->isDynamicClass() ||
>> - ClassDecl->needsOverloadResolutionForCopyAssignment())
>> + ClassDecl->needsOverloadResolutionForCopyAssignment() ||
>> + ClassDecl->hasInheritedAssignment())
>> DeclareImplicitCopyAssignment(ClassDecl);
>> }
>>
>> @@ -6489,7 +6498,8 @@ void Sema::AddImplicitlyDeclaredMembersT
>>
>> // Likewise for the move assignment operator.
>> if (ClassDecl->isDynamicClass() ||
>> - ClassDecl->needsOverloadResolutionForMoveAssignment())
>> + ClassDecl->needsOverloadResolutionForMoveAssignment() ||
>> + ClassDecl->hasInheritedAssignment())
>> DeclareImplicitMoveAssignment(ClassDecl);
>> }
>>
>> @@ -8898,10 +8908,11 @@ namespace {
>> struct DeclaringSpecialMember {
>> Sema &S;
>> Sema::SpecialMemberDecl D;
>> + Sema::ContextRAII SavedContext;
>> bool WasAlreadyBeingDeclared;
>>
>> DeclaringSpecialMember(Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM)
>> - : S(S), D(RD, CSM) {
>> + : S(S), D(RD, CSM), SavedContext(S, RD) {
>> WasAlreadyBeingDeclared = !S.SpecialMembersBeingDeclared.insert(D).second;
>> if (WasAlreadyBeingDeclared)
>> // This almost never happens, but if it does, ensure that our cache
>> @@ -8923,6 +8934,20 @@ struct DeclaringSpecialMember {
>> };
>> }
>>
>> +void Sema::CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD) {
>> + // Look up any existing declarations, but don't trigger declaration of all
>> + // implicit special members with this name.
>> + DeclarationName Name = FD->getDeclName();
>> + LookupResult R(*this, Name, SourceLocation(), LookupOrdinaryName,
>> + ForRedeclaration);
>> + for (auto *D : FD->getParent()->lookup(Name))
>> + if (auto *Acceptable = R.getAcceptableDecl(D))
>> + R.addDecl(Acceptable);
>> + R.resolveKind();
>> +
>> + CheckFunctionDeclaration(S, FD, R, /*IsExplicitSpecialization*/false);
>> +}
>> +
>> CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
>> CXXRecordDecl *ClassDecl) {
>> // C++ [class.ctor]p5:
>> @@ -8971,13 +8996,16 @@ CXXConstructorDecl *Sema::DeclareImplici
>> // constructors is easy to compute.
>> DefaultCon->setTrivial(ClassDecl->hasTrivialDefaultConstructor());
>>
>> - if (ShouldDeleteSpecialMember(DefaultCon, CXXDefaultConstructor))
>> - SetDeclDeleted(DefaultCon, ClassLoc);
>> -
>> // Note that we have declared this constructor.
>> ++ASTContext::NumImplicitDefaultConstructorsDeclared;
>>
>> - if (Scope *S = getScopeForContext(ClassDecl))
>> + Scope *S = getScopeForContext(ClassDecl);
>> + CheckImplicitSpecialMemberDeclaration(S, DefaultCon);
>> +
>> + if (ShouldDeleteSpecialMember(DefaultCon, CXXDefaultConstructor))
>> + SetDeclDeleted(DefaultCon, ClassLoc);
>> +
>> + if (S)
>> PushOnScopeChains(DefaultCon, S, false);
>> ClassDecl->addDecl(DefaultCon);
>>
>> @@ -9433,20 +9461,21 @@ CXXDestructorDecl *Sema::DeclareImplicit
>> FunctionProtoType::ExtProtoInfo EPI = getImplicitMethodEPI(*this, Destructor);
>> Destructor->setType(Context.getFunctionType(Context.VoidTy, None, EPI));
>>
>> - AddOverriddenMethods(ClassDecl, Destructor);
>> -
>> // We don't need to use SpecialMemberIsTrivial here; triviality for
>> // destructors is easy to compute.
>> Destructor->setTrivial(ClassDecl->hasTrivialDestructor());
>>
>> - if (ShouldDeleteSpecialMember(Destructor, CXXDestructor))
>> - SetDeclDeleted(Destructor, ClassLoc);
>> -
>> // Note that we have declared this destructor.
>> ++ASTContext::NumImplicitDestructorsDeclared;
>>
>> + Scope *S = getScopeForContext(ClassDecl);
>> + CheckImplicitSpecialMemberDeclaration(S, Destructor);
>> +
>> + if (ShouldDeleteSpecialMember(Destructor, CXXDestructor))
>> + SetDeclDeleted(Destructor, ClassLoc);
>> +
>> // Introduce this destructor into its scope.
>> - if (Scope *S = getScopeForContext(ClassDecl))
>> + if (S)
>> PushOnScopeChains(Destructor, S, false);
>> ClassDecl->addDecl(Destructor);
>>
>> @@ -10147,20 +10176,21 @@ CXXMethodDecl *Sema::DeclareImplicitCopy
>> nullptr);
>> CopyAssignment->setParams(FromParam);
>>
>> - AddOverriddenMethods(ClassDecl, CopyAssignment);
>> -
>> CopyAssignment->setTrivial(
>> ClassDecl->needsOverloadResolutionForCopyAssignment()
>> ? SpecialMemberIsTrivial(CopyAssignment, CXXCopyAssignment)
>> : ClassDecl->hasTrivialCopyAssignment());
>>
>> - if (ShouldDeleteSpecialMember(CopyAssignment, CXXCopyAssignment))
>> - SetDeclDeleted(CopyAssignment, ClassLoc);
>> -
>> // Note that we have added this copy-assignment operator.
>> ++ASTContext::NumImplicitCopyAssignmentOperatorsDeclared;
>>
>> - if (Scope *S = getScopeForContext(ClassDecl))
>> + Scope *S = getScopeForContext(ClassDecl);
>> + CheckImplicitSpecialMemberDeclaration(S, CopyAssignment);
>> +
>> + if (ShouldDeleteSpecialMember(CopyAssignment, CXXCopyAssignment))
>> + SetDeclDeleted(CopyAssignment, ClassLoc);
>> +
>> + if (S)
>> PushOnScopeChains(CopyAssignment, S, false);
>> ClassDecl->addDecl(CopyAssignment);
>>
>> @@ -10538,22 +10568,23 @@ CXXMethodDecl *Sema::DeclareImplicitMove
>> nullptr);
>> MoveAssignment->setParams(FromParam);
>>
>> - AddOverriddenMethods(ClassDecl, MoveAssignment);
>> -
>> MoveAssignment->setTrivial(
>> ClassDecl->needsOverloadResolutionForMoveAssignment()
>> ? SpecialMemberIsTrivial(MoveAssignment, CXXMoveAssignment)
>> : ClassDecl->hasTrivialMoveAssignment());
>>
>> + // Note that we have added this copy-assignment operator.
>> + ++ASTContext::NumImplicitMoveAssignmentOperatorsDeclared;
>> +
>> + Scope *S = getScopeForContext(ClassDecl);
>> + CheckImplicitSpecialMemberDeclaration(S, MoveAssignment);
>> +
>> if (ShouldDeleteSpecialMember(MoveAssignment, CXXMoveAssignment)) {
>> ClassDecl->setImplicitMoveAssignmentIsDeleted();
>> SetDeclDeleted(MoveAssignment, ClassLoc);
>> }
>>
>> - // Note that we have added this copy-assignment operator.
>> - ++ASTContext::NumImplicitMoveAssignmentOperatorsDeclared;
>> -
>> - if (Scope *S = getScopeForContext(ClassDecl))
>> + if (S)
>> PushOnScopeChains(MoveAssignment, S, false);
>> ClassDecl->addDecl(MoveAssignment);
>>
>> @@ -10979,13 +11010,16 @@ CXXConstructorDecl *Sema::DeclareImplici
>> ? SpecialMemberIsTrivial(CopyConstructor, CXXCopyConstructor)
>> : ClassDecl->hasTrivialCopyConstructor());
>>
>> - if (ShouldDeleteSpecialMember(CopyConstructor, CXXCopyConstructor))
>> - SetDeclDeleted(CopyConstructor, ClassLoc);
>> -
>> // Note that we have declared this constructor.
>> ++ASTContext::NumImplicitCopyConstructorsDeclared;
>>
>> - if (Scope *S = getScopeForContext(ClassDecl))
>> + Scope *S = getScopeForContext(ClassDecl);
>> + CheckImplicitSpecialMemberDeclaration(S, CopyConstructor);
>> +
>> + if (ShouldDeleteSpecialMember(CopyConstructor, CXXCopyConstructor))
>> + SetDeclDeleted(CopyConstructor, ClassLoc);
>> +
>> + if (S)
>> PushOnScopeChains(CopyConstructor, S, false);
>> ClassDecl->addDecl(CopyConstructor);
>>
>> @@ -11156,15 +11190,18 @@ CXXConstructorDecl *Sema::DeclareImplici
>> ? SpecialMemberIsTrivial(MoveConstructor, CXXMoveConstructor)
>> : ClassDecl->hasTrivialMoveConstructor());
>>
>> + // Note that we have declared this constructor.
>> + ++ASTContext::NumImplicitMoveConstructorsDeclared;
>> +
>> + Scope *S = getScopeForContext(ClassDecl);
>> + CheckImplicitSpecialMemberDeclaration(S, MoveConstructor);
>> +
>> if (ShouldDeleteSpecialMember(MoveConstructor, CXXMoveConstructor)) {
>> ClassDecl->setImplicitMoveConstructorIsDeleted();
>> SetDeclDeleted(MoveConstructor, ClassLoc);
>> }
>>
>> - // Note that we have declared this constructor.
>> - ++ASTContext::NumImplicitMoveConstructorsDeclared;
>> -
>> - if (Scope *S = getScopeForContext(ClassDecl))
>> + if (S)
>> PushOnScopeChains(MoveConstructor, S, false);
>> ClassDecl->addDecl(MoveConstructor);
>>
>>
>> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
>> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Fri May 13 01:47:56 2016
>> @@ -1466,6 +1466,8 @@ void ASTDeclReader::ReadCXXDefinitionDat
>> Data.HasInClassInitializer = Record[Idx++];
>> Data.HasUninitializedReferenceMember = Record[Idx++];
>> Data.HasUninitializedFields = Record[Idx++];
>> + Data.HasInheritedConstructor = Record[Idx++];
>> + Data.HasInheritedAssignment = Record[Idx++];
>> Data.NeedOverloadResolutionForMoveConstructor = Record[Idx++];
>> Data.NeedOverloadResolutionForMoveAssignment = Record[Idx++];
>> Data.NeedOverloadResolutionForDestructor = Record[Idx++];
>> @@ -1593,6 +1595,8 @@ void ASTDeclReader::MergeDefinitionData(
>> MATCH_FIELD(HasInClassInitializer)
>> MATCH_FIELD(HasUninitializedReferenceMember)
>> MATCH_FIELD(HasUninitializedFields)
>> + MATCH_FIELD(HasInheritedConstructor)
>> + MATCH_FIELD(HasInheritedAssignment)
>> MATCH_FIELD(NeedOverloadResolutionForMoveConstructor)
>> MATCH_FIELD(NeedOverloadResolutionForMoveAssignment)
>> MATCH_FIELD(NeedOverloadResolutionForDestructor)
>>
>> Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
>> +++ cfe/trunk/lib/Serialization/ASTWriter.cpp Fri May 13 01:47:56 2016
>> @@ -5489,6 +5489,8 @@ void ASTRecordWriter::AddCXXDefinitionDa
>> Record->push_back(Data.HasInClassInitializer);
>> Record->push_back(Data.HasUninitializedReferenceMember);
>> Record->push_back(Data.HasUninitializedFields);
>> + Record->push_back(Data.HasInheritedConstructor);
>> + Record->push_back(Data.HasInheritedAssignment);
>> Record->push_back(Data.NeedOverloadResolutionForMoveConstructor);
>> Record->push_back(Data.NeedOverloadResolutionForMoveAssignment);
>> Record->push_back(Data.NeedOverloadResolutionForDestructor);
>>
>> Modified: cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp (original)
>> +++ cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp Fri May 13 01:47:56 2016
>> @@ -1,3 +1,5 @@
>> +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
>> +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
>> // RUN: %clang_cc1 -fsyntax-only -verify %s
>>
>> // C++03 [namespace.udecl]p12:
>> @@ -161,3 +163,33 @@ namespace test4 {
>> d.bar<int>(3); // expected-error {{'bar' is a protected member}}
>> }
>> }
>> +
>> +namespace test5 {
>> + struct Derived;
>> + struct Base {
>> + void operator=(const Derived&);
>> + };
>> + struct Derived : Base {
>> + // Hidden by implicit derived class operator.
>> + using Base::operator=;
>> + };
>> + void f(Derived d) {
>> + d = d;
>> + }
>> +}
>> +
>> +#if __cplusplus >= 201103L
>> +namespace test6 {
>> + struct Derived;
>> + struct Base {
>> + void operator=(Derived&&);
>> + };
>> + struct Derived : Base {
>> + // Hidden by implicit derived class operator.
>> + using Base::operator=;
>> + };
>> + void f(Derived d) {
>> + d = Derived();
>> + }
>> +}
>> +#endif
>>
>> Modified: cfe/trunk/test/SemaCUDA/implicit-member-target.cu <http://implicit-member-target.cu>
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCUDA/implicit-member-target.cu?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/SemaCUDA/implicit-member-target.cu <http://implicit-member-target.cu> (original)
>> +++ cfe/trunk/test/SemaCUDA/implicit-member-target.cu <http://implicit-member-target.cu> Fri May 13 01:47:56 2016
>> @@ -60,13 +60,14 @@ struct A3_with_device_ctors {
>>
>> struct B3_with_implicit_ctors : A3_with_device_ctors {
>> };
>> +// expected-note at -2 2{{call to __device__ function from __host__ function}}
>> +// expected-note at -3 {{default constructor}}
>>
>> -// expected-note at -3 {{copy constructor of 'B3_with_implicit_ctors' is implicitly deleted}}
>>
>> void hostfoo3() {
>> B3_with_implicit_ctors b; // this is OK because the inferred default ctor
>> // here is __host__
>> - B3_with_implicit_ctors b2 = b; // expected-error {{call to implicitly-deleted copy constructor}}
>> + B3_with_implicit_ctors b2 = b; // expected-error {{no matching constructor}}
>>
>> }
>>
>>
>> Modified: cfe/trunk/test/SemaCXX/constructor-recovery.cpp
>> URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constructor-recovery.cpp?rev=269398&r1=269397&r2=269398&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/SemaCXX/constructor-recovery.cpp (original)
>> +++ cfe/trunk/test/SemaCXX/constructor-recovery.cpp Fri May 13 01:47:56 2016
>> @@ -1,9 +1,9 @@
>> // RUN: %clang_cc1 -fsyntax-only -verify %s
>>
>> -struct C {
>> +struct C { // expected-note 1+{{candidate}}
>> virtual C() = 0; // expected-error{{constructor cannot be declared 'virtual'}}
>> };
>>
>> void f() {
>> - C c;
>> + C c; // expected-error {{no matching constructor}}
>> }
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160516/17be11d3/attachment-0001.html>
More information about the cfe-commits
mailing list