Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -8880,7 +8880,7 @@ return; } - SourceLocation Loc = Destructor->getLocation(); + SourceLocation Loc = Destructor->getLocEnd(); Destructor->setBody(new (Context) CompoundStmt(Loc)); Destructor->markUsed(Context); MarkVTableUsed(CurrentLocation, ClassDecl); Index: test/Misc/ast-dump-decl.cpp =================================================================== --- test/Misc/ast-dump-decl.cpp +++ test/Misc/ast-dump-decl.cpp @@ -133,6 +133,18 @@ // CHECK: CXXDestructorDecl{{.*}} ~TestCXXDestructorDecl 'void (void) noexcept' // CHECK-NEXT: CompoundStmt +// Test that the range of a defaulted destructor is computed correctly. +// FIXME: This should include the "= default". +class Base { +public: + virtual ~Base() {} +}; +class TestDerived : public Base { + TestDerived() {} + ~TestDerived() = default; +}; +// CHECK: CXXDestructorDecl{{.*}} + class TestCXXConversionDecl { operator int() { return 0; } };