Index: include/clang/AST/Decl.h =================================================================== --- include/clang/AST/Decl.h +++ include/clang/AST/Decl.h @@ -1831,14 +1831,26 @@ return getBody(Definition); } - /// isThisDeclarationADefinition - Returns whether this specific - /// declaration of the function is also a definition. This does not - /// determine whether the function has been defined (e.g., in a - /// previous definition); for that information, use isDefined. Note - /// that this returns false for a defaulted function unless that function - /// has been implicitly defined (possibly as deleted). + /// Returns whether this specific declaration of the function is also + /// a definition. + /// + /// The method checks for definiteness of the declaration in the sense, used + /// in redefinition checks. A defined function usually cannot have more than + /// one definition. At the same time it may have its body absent, for instance, + /// because it does not exist at all as in deleted functions, or is not + /// instantiated yet as in templated entities. Corresponding declarations are + /// also reported as definitions. + /// + /// This does not determine whether the function has been defined (e.g., in a + /// previous definition); for that information, use isDefined. + /// bool isThisDeclarationADefinition() const { - return IsDeleted || Body || IsLateTemplateParsed; + if (IsDeleted || IsDefaulted || Body || IsLateTemplateParsed || + hasDefiningAttr()) + return true; + if (FunctionDecl *Original = getInstantiatedFromMemberFunction()) + return Original->isThisDeclarationADefinition(); + return false; } /// doesThisDeclarationHaveABody - Returns whether this specific Index: test/SemaCXX/cxx0x-cursory-default-delete.cpp =================================================================== --- test/SemaCXX/cxx0x-cursory-default-delete.cpp +++ test/SemaCXX/cxx0x-cursory-default-delete.cpp @@ -136,13 +136,13 @@ }; struct DefaultDelete { - DefaultDelete() = default; // expected-note {{previous declaration is here}} + DefaultDelete() = default; // expected-note {{previous definition is here}} DefaultDelete() = delete; // expected-error {{constructor cannot be redeclared}} - ~DefaultDelete() = default; // expected-note {{previous declaration is here}} + ~DefaultDelete() = default; // expected-note {{previous definition is here}} ~DefaultDelete() = delete; // expected-error {{destructor cannot be redeclared}} - DefaultDelete &operator=(const DefaultDelete &) = default; // expected-note {{previous declaration is here}} + DefaultDelete &operator=(const DefaultDelete &) = default; // expected-note {{previous definition is here}} DefaultDelete &operator=(const DefaultDelete &) = delete; // expected-error {{class member cannot be redeclared}} };