From 6c307aee7b8a7204f554197f39e4bc4df2f6568c Mon Sep 17 00:00:00 2001 From: Matt Beaumont-Gay Date: Thu, 19 May 2011 23:44:42 +0000 Subject: [PATCH] Undo enough of r131143 to make private copy ctor diags say "copy constructor" again llvm-svn: 131706 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 5 +++-- clang/lib/Sema/SemaAccess.cpp | 8 ++++++-- clang/test/CXX/class.access/p4.cpp | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 7e3cf03d5309..84106856ca76 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -603,9 +603,10 @@ def ext_rvalue_to_reference_access_ctor : ExtWarn< AccessControl, InGroup; def err_access_base_ctor : Error< "%select{base class|inherited virtual base class}0 %1 has %select{private|" - "protected}2 constructor">, AccessControl; + "protected}3 %select{|copy }2constructor">, AccessControl; def err_access_field_ctor : Error< - "field of type %0 has %select{private|protected}1 constructor">, AccessControl; + "field of type %0 has %select{private|protected}2 " + "%select{|copy }1constructor">, AccessControl; def err_access_ctor_field : Error<"field of type %1 has %select{private|protected}2 constructor">, diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index 80995eb66ff4..e92d19d13d36 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -1425,13 +1425,17 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc, case InitializedEntity::EK_Base: AccessEntity.setDiag(PDiag(diag::err_access_base_ctor) << Entity.isInheritedVirtualBase() - << Entity.getBaseSpecifier()->getType()); + << Entity.getBaseSpecifier()->getType() + << (getSpecialMember(Constructor) == + Sema::CXXCopyConstructor)); break; case InitializedEntity::EK_Member: { const FieldDecl *Field = cast(Entity.getDecl()); AccessEntity.setDiag(PDiag(diag::err_access_field_ctor) - << Field->getType()); + << Field->getType() + << (getSpecialMember(Constructor) == + Sema::CXXCopyConstructor)); break; } diff --git a/clang/test/CXX/class.access/p4.cpp b/clang/test/CXX/class.access/p4.cpp index 3157b87f7eb7..f28a3714e729 100644 --- a/clang/test/CXX/class.access/p4.cpp +++ b/clang/test/CXX/class.access/p4.cpp @@ -224,12 +224,12 @@ namespace test6 { private: A(const A &); // expected-note 2 {{declared private here}} }; - class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private constructor}} + class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private copy constructor}} void test1(const Test1 &t) { Test1 a = t; // expected-note{{implicit default copy}} } - class Test2 : A {}; // expected-error {{base class 'test6::A' has private constructor}} + class Test2 : A {}; // expected-error {{base class 'test6::A' has private copy constructor}} void test2(const Test2 &t) { Test2 a = t; // expected-note{{implicit default copy}} }