diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -463,12 +463,12 @@ else if (isa(*D) && cast(*D)->hasBody()) Terminator = nullptr; else if (auto FD = dyn_cast(*D)) { - if (FD->isThisDeclarationADefinition()) + if (FD->doesThisDeclarationHaveABody() && !FD->isDefaulted()) Terminator = nullptr; else Terminator = ";"; } else if (auto TD = dyn_cast(*D)) { - if (TD->getTemplatedDecl()->isThisDeclarationADefinition()) + if (TD->getTemplatedDecl()->doesThisDeclarationHaveABody()) Terminator = nullptr; else Terminator = ";"; diff --git a/clang/test/AST/ast-print-method-decl.cpp b/clang/test/AST/ast-print-method-decl.cpp --- a/clang/test/AST/ast-print-method-decl.cpp +++ b/clang/test/AST/ast-print-method-decl.cpp @@ -85,3 +85,18 @@ // CHECK-NEXT: }; }; + + +// CHECK: struct DefMethodsWithoutBody { +struct DefMethodsWithoutBody { + // CHECK-NEXT: DefMethodsWithoutBody() = delete; + DefMethodsWithoutBody() = delete; + + // CHECK-NEXT: DefMethodsWithoutBody() = default; + ~DefMethodsWithoutBody() = default; + + // CHECK-NEXT: void m1() __attribute__((alias("X"))); + void m1() __attribute__((alias("X"))); + + // CHECK-NEXT: }; +};