]> granicus.if.org Git - clang/commitdiff
Undo enough of r131143 to make private copy ctor diags say "copy constructor" again
authorMatt Beaumont-Gay <matthewbg@google.com>
Thu, 19 May 2011 23:44:42 +0000 (23:44 +0000)
committerMatt Beaumont-Gay <matthewbg@google.com>
Thu, 19 May 2011 23:44:42 +0000 (23:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131706 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaAccess.cpp
test/CXX/class.access/p4.cpp

index 7e3cf03d53092f6ab184a88a1ba7425ac92f35e3..84106856ca76feceb73dfeefb13d5513513865e9 100644 (file)
@@ -603,9 +603,10 @@ def ext_rvalue_to_reference_access_ctor : ExtWarn<
   AccessControl, InGroup<BindToTemporaryCopy>;
 def err_access_base_ctor : Error<
   "%select{base class|inherited virtual base class}0 %1 has %select{private|"
-  "protected}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">,
index 80995eb66ff40dab203da53e489a03fb1c63cc50..e92d19d13d36750ce3cfd7a7588162207e81a35f 100644 (file)
@@ -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<FieldDecl>(Entity.getDecl());
     AccessEntity.setDiag(PDiag(diag::err_access_field_ctor)
-                          << Field->getType());
+                          << Field->getType()
+                          << (getSpecialMember(Constructor) ==
+                              Sema::CXXCopyConstructor));
     break;
   }
 
index 3157b87f7eb77fe93cbfa6a6b5c24cae269ce58e..f28a3714e729c34dffbf64945afec53e530e7627 100644 (file)
@@ -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}}
   }