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 @@ -309,6 +309,8 @@ for (const auto *BMInitializer : CDecl->inits()) { if (BMInitializer->isInClassMemberInitializer()) continue; + if (!BMInitializer->isWritten()) + continue; if (!HasInitializerList) { Proto += " : "; 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 @@ -100,3 +100,26 @@ // CHECK-NEXT: }; }; + + +// ---- Check that implict (non-written) constructor initializers are not output + +struct ImplicitCtorInit1 { + int a; +}; + +// CHECK: struct ImplicitCtorInit2 : ImplicitCtorInit1 { +struct ImplicitCtorInit2 : ImplicitCtorInit1 { + + // CHECK-NEXT: ImplicitCtorInit2(int *) { + ImplicitCtorInit2(int *) { + // CHECK-NEXT: } + } + + // CHECK-NEXT: ImplicitCtorInit2(int **) : ImplicitCtorInit1() { + ImplicitCtorInit2(int **) : ImplicitCtorInit1() { + // CHECK-NEXT: } + } + + // CHECK-NEXT: }; +};