public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] Emit error + inform for access control issues
@ 2015-04-04 13:00 Paolo Carlini
  2015-04-06 14:07 ` Jason Merrill
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Carlini @ 2015-04-04 13:00 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

Hi,

I noticed a while ago that for each access control issue we emit two 
errors instead of an error + an inform, as we lately try to consistently 
do. I also noticed that the testsuite reflects that in many testcases... 
Anyway, the below - for next Stage 1? - implements the change, passes 
testing on x86_64-linux.

Thanks,
Paolo.

///////////////////////////

[-- Attachment #2: patch_access_error_inform --]
[-- Type: text/plain, Size: 63685 bytes --]

Index: cp/call.c
===================================================================
--- cp/call.c	(revision 221865)
+++ cp/call.c	(working copy)
@@ -6025,7 +6025,7 @@ enforce_access (tree basetype_path, tree decl, tre
 	    error ("%q+#D is protected", diag_decl);
 	  else
 	    error ("%q+#D is inaccessible", diag_decl);
-	  error ("within this context");
+	  inform (input_location, "within this context");
 	}
       return false;
     }
Index: testsuite/g++.dg/cpp0x/alias-decl-22.C
===================================================================
--- testsuite/g++.dg/cpp0x/alias-decl-22.C	(revision 221865)
+++ testsuite/g++.dg/cpp0x/alias-decl-22.C	(working copy)
@@ -3,7 +3,7 @@
 // { dg-do compile { target c++11 } }
 
 template <class T>
-using foo = typename T::bar;	// { dg-error "this context" }
+using foo = typename T::bar;	// { dg-message "this context" }
 
 class B
 {
Index: testsuite/g++.dg/cpp0x/decltype-call1.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype-call1.C	(revision 221865)
+++ testsuite/g++.dg/cpp0x/decltype-call1.C	(working copy)
@@ -27,6 +27,6 @@ B h();
 void i(const B&);
 
 decltype(h()) g5a();		// OK
-decltype(h().i) g5();		// { dg-error "" }
-decltype(h()[0]) g6();		// { dg-error "" }
-decltype(i(h())) g7();		// { dg-error "" }
+decltype(h().i) g5();		// { dg-message "" }
+decltype(h()[0]) g6();		// { dg-message "" }
+decltype(i(h())) g7();		// { dg-message "" }
Index: testsuite/g++.dg/cpp0x/defaulted28.C
===================================================================
--- testsuite/g++.dg/cpp0x/defaulted28.C	(revision 221865)
+++ testsuite/g++.dg/cpp0x/defaulted28.C	(working copy)
@@ -12,6 +12,6 @@ struct A {
 int f(...) { }
 int main() {
   A a;
-  f(a); 			// { dg-error "this context" }
+  f(a); 			// { dg-message "this context" }
   sizeof(f(a));			// OK because unevaluated
 }
Index: testsuite/g++.dg/cpp0x/defaulted47.C
===================================================================
--- testsuite/g++.dg/cpp0x/defaulted47.C	(revision 221865)
+++ testsuite/g++.dg/cpp0x/defaulted47.C	(working copy)
@@ -6,7 +6,7 @@ class A
   A() = default;   // { dg-error "private" }
 };
 
-A a;               // { dg-error "context" }
+A a;               // { dg-message "context" }
 
 class B
 {
@@ -13,4 +13,4 @@ class B
   ~B() = default;  // { dg-error "private" }
 };
 
-B b;               // { dg-error "context" }
+B b;               // { dg-message "context" }
Index: testsuite/g++.dg/cpp0x/elision_neg.C
===================================================================
--- testsuite/g++.dg/cpp0x/elision_neg.C	(revision 221865)
+++ testsuite/g++.dg/cpp0x/elision_neg.C	(working copy)
@@ -24,13 +24,13 @@ move_only
 test1()
 {
     static move_only x;
-    return x;  //  { dg-error "within this context" }
+    return x;  //  { dg-message "within this context" }
 }
 
 move_only
 test2(move_only&& x)
 {
-    return x;  //  { dg-error "within this context" }
+    return x;  //  { dg-message "within this context" }
 }
 
 int main()
Index: testsuite/g++.dg/cpp0x/fntmpdefarg3.C
===================================================================
--- testsuite/g++.dg/cpp0x/fntmpdefarg3.C	(revision 221865)
+++ testsuite/g++.dg/cpp0x/fntmpdefarg3.C	(working copy)
@@ -4,7 +4,7 @@ template <class T, class = typename T::I> void f(T
 template <class T, class = typename T::I> void g(T) {}
 template <class T, class = typename T::I> void h(T) {}
 template <class T, class = typename T::I> void i(T) {}
-template <class T, class = typename T::I> void j(T) {} // { dg-error "this context" }
+template <class T, class = typename T::I> void j(T) {} // { dg-message "this context" }
 
 class A
 {
Index: testsuite/g++.dg/cpp0x/inh-ctor9.C
===================================================================
--- testsuite/g++.dg/cpp0x/inh-ctor9.C	(revision 221865)
+++ testsuite/g++.dg/cpp0x/inh-ctor9.C	(working copy)
@@ -12,4 +12,4 @@ struct B: A
   using A::A;			// { dg-error "protected" }
 };
 
-B b(42);			// { dg-error "this context" }
+B b(42);			// { dg-message "this context" }
Index: testsuite/g++.dg/cpp0x/range-for13.C
===================================================================
--- testsuite/g++.dg/cpp0x/range-for13.C	(revision 221865)
+++ testsuite/g++.dg/cpp0x/range-for13.C	(working copy)
@@ -91,12 +91,12 @@ void test1()
 {
   for (int x : container1()); // { dg-error "member but not" }
   for (int x : container2()); // { dg-error "member but not" }
-  for (int x : container3()); // { dg-error "within this context" }
+  for (int x : container3()); // { dg-message "within this context" }
   for (int x : container4()); // { dg-error "cannot be used as a function" }
   for (int x : container5()); // { dg-error "invalid use of" }
   for (int x : container6());
   for (int x : container7());
   for (int x : container8());
-  for (int x : container9()); // { dg-error "within this context" }
+  for (int x : container9()); // { dg-message "within this context" }
   for (int x : container10());
 }
Index: testsuite/g++.dg/gomp/clause-2.C
===================================================================
--- testsuite/g++.dg/gomp/clause-2.C	(revision 221865)
+++ testsuite/g++.dg/gomp/clause-2.C	(working copy)
@@ -19,19 +19,19 @@ void foo()
 
   #pragma omp parallel private(a, b, c, d, f, g)
     bar();
-  #pragma omp parallel private(e)		// { dg-error "context" }
+  #pragma omp parallel private(e)		// { dg-message "context" }
     bar();
 
   #pragma omp parallel firstprivate(a, b, c, d, e, g)
     bar();
-  #pragma omp parallel firstprivate(f)		// { dg-error "context" }
+  #pragma omp parallel firstprivate(f)		// { dg-message "context" }
     bar();
 
   #pragma omp parallel sections lastprivate(a, b, d, c, f)
     { bar(); }
-  #pragma omp parallel sections lastprivate(e)	// { dg-error "context" }
+  #pragma omp parallel sections lastprivate(e)	// { dg-message "context" }
     { bar(); }
-  #pragma omp parallel sections lastprivate(g)	// { dg-error "context" }
+  #pragma omp parallel sections lastprivate(g)	// { dg-message "context" }
     { bar(); }
   #pragma omp parallel sections firstprivate(e) lastprivate(e)
     { bar(); }
Index: testsuite/g++.dg/gomp/udr-5.C
===================================================================
--- testsuite/g++.dg/gomp/udr-5.C	(revision 221865)
+++ testsuite/g++.dg/gomp/udr-5.C	(working copy)
@@ -15,13 +15,13 @@ struct T : public S
   void foo ()
   {
     S s;
-    #pragma omp parallel reduction (S::operator +:s)	// { dg-error "within this context" }
+    #pragma omp parallel reduction (S::operator +:s)	// { dg-message "within this context" }
     s.s = 1;
     S t;
     #pragma omp parallel reduction (S::operator -:t)
     t.s = 1;
     S u;
-    #pragma omp parallel reduction (+:u)		// { dg-error "within this context" }
+    #pragma omp parallel reduction (+:u)		// { dg-message "within this context" }
     u.s = 1;
     S v;
     #pragma omp parallel reduction (-:v)
@@ -33,9 +33,9 @@ void
 foo ()
 {
   S s;
-  #pragma omp parallel reduction (S::operator +:s)	// { dg-error "within this context" }
+  #pragma omp parallel reduction (S::operator +:s)	// { dg-message "within this context" }
   s.s = 1;
   S t;
-  #pragma omp parallel reduction (S::operator -:t)	// { dg-error "within this context" }
+  #pragma omp parallel reduction (S::operator -:t)	// { dg-message "within this context" }
   t.s = 1;
 }
Index: testsuite/g++.dg/inherit/access6.C
===================================================================
--- testsuite/g++.dg/inherit/access6.C	(revision 221865)
+++ testsuite/g++.dg/inherit/access6.C	(working copy)
@@ -10,6 +10,6 @@ void h()
 {
   Foo foo;
   void (*f)();
-  f = foo.f; // { dg-error "context" }
-  f = foo.g; // { dg-error "context" }
+  f = foo.f; // { dg-message "context" }
+  f = foo.g; // { dg-message "context" }
 }
Index: testsuite/g++.dg/lookup/duperr1.C
===================================================================
--- testsuite/g++.dg/lookup/duperr1.C	(revision 221865)
+++ testsuite/g++.dg/lookup/duperr1.C	(working copy)
@@ -2,4 +2,4 @@
 
 class A { int i; }; // { dg-bogus "is private.*is private" }
 // { dg-error "is private" "" { target *-*-* } 3 }
-class B:public A { B() { A::i=0; } }; // { dg-error "within this context" }
+class B:public A { B() { A::i=0; } }; // { dg-message "within this context" }
Index: testsuite/g++.dg/lookup/friend2.C
===================================================================
--- testsuite/g++.dg/lookup/friend2.C	(revision 221865)
+++ testsuite/g++.dg/lookup/friend2.C	(working copy)
@@ -17,5 +17,5 @@ namespace NS {
 }
 
 void S::test () {
-  NS::X::i;		// { dg-error "this context" }
+  NS::X::i;		// { dg-message "this context" }
 }
Index: testsuite/g++.dg/lookup/pr6936.C
===================================================================
--- testsuite/g++.dg/lookup/pr6936.C	(revision 221865)
+++ testsuite/g++.dg/lookup/pr6936.C	(working copy)
@@ -20,4 +20,4 @@ struct Derv : Base
 };
 
 int k = Derv::j;
-int l = Derv::i; // { dg-error "context" }
+int l = Derv::i; // { dg-message "context" }
Index: testsuite/g++.dg/lookup/using26.C
===================================================================
--- testsuite/g++.dg/lookup/using26.C	(revision 221865)
+++ testsuite/g++.dg/lookup/using26.C	(working copy)
@@ -17,7 +17,7 @@ struct C
     int next;
 };
 
-struct D : A, B, C // { dg-error "context" }
+struct D : A, B, C // { dg-message "context" }
 {
     using B::next;
     void f()
Index: testsuite/g++.dg/lookup/using38.C
===================================================================
--- testsuite/g++.dg/lookup/using38.C	(revision 221865)
+++ testsuite/g++.dg/lookup/using38.C	(working copy)
@@ -20,4 +20,4 @@ struct Derv : Base
 };
 
 int k = Derv::j;
-int l = Derv::i; // { dg-error "context" }
+int l = Derv::i; // { dg-message "context" }
Index: testsuite/g++.dg/other/access2.C
===================================================================
--- testsuite/g++.dg/other/access2.C	(revision 221865)
+++ testsuite/g++.dg/other/access2.C	(working copy)
@@ -23,7 +23,7 @@ int Base::fooprotected=42;
 int Base::foopublic=42;
 
 void Derived::test() {
-  if ( fooprivate );		// { dg-error "context" }
+  if ( fooprivate );		// { dg-message "context" }
   if ( fooprotected );
   if ( foopublic );
 }
Index: testsuite/g++.dg/overload/defarg3.C
===================================================================
--- testsuite/g++.dg/overload/defarg3.C	(revision 221865)
+++ testsuite/g++.dg/overload/defarg3.C	(working copy)
@@ -11,5 +11,5 @@ class D {
 public:
   /* C::f is inaccessible, so this is an error, even if this function
      is never called.  */
-  static void g(int (*)(int) = C::f); // { dg-error "context" }
+  static void g(int (*)(int) = C::f); // { dg-message "context" }
 };
Index: testsuite/g++.dg/overload/defarg6.C
===================================================================
--- testsuite/g++.dg/overload/defarg6.C	(revision 221865)
+++ testsuite/g++.dg/overload/defarg6.C	(working copy)
@@ -4,4 +4,4 @@ class A
   A(int i): i(i) {}		// { dg-error "private" }
 };
 
-void f (A = 1) { }		// { dg-error "context" }
+void f (A = 1) { }		// { dg-message "context" }
Index: testsuite/g++.dg/parse/access11.C
===================================================================
--- testsuite/g++.dg/parse/access11.C	(revision 221865)
+++ testsuite/g++.dg/parse/access11.C	(working copy)
@@ -26,10 +26,10 @@ class A {
   };
 };
 
-int a1 = A().i;  // { dg-error "context" }
-int a2 = A().j;  // { dg-error "context" }
-int a3 = A().k;  // { dg-error "context" }
-int a4 = A().l;  // { dg-error "context" }
-int a5 = A().m;  // { dg-error "context" }
-int a6 = A().n;  // { dg-error "context" }
-int a7 = A().o;  // { dg-error "context" }
+int a1 = A().i;  // { dg-message "context" }
+int a2 = A().j;  // { dg-message "context" }
+int a3 = A().k;  // { dg-message "context" }
+int a4 = A().l;  // { dg-message "context" }
+int a5 = A().m;  // { dg-message "context" }
+int a6 = A().n;  // { dg-message "context" }
+int a7 = A().o;  // { dg-message "context" }
Index: testsuite/g++.dg/parse/access2.C
===================================================================
--- testsuite/g++.dg/parse/access2.C	(revision 221865)
+++ testsuite/g++.dg/parse/access2.C	(working copy)
@@ -10,6 +10,6 @@ class A {
 };
 
 A::X A::a;
-A::X A::b, x;		// { dg-error "this context" }
-A::X y, A::c;		// { dg-error "this context" }
-A::X z;			// { dg-error "this context" }
+A::X A::b, x;		// { dg-message "this context" }
+A::X y, A::c;		// { dg-message "this context" }
+A::X z;			// { dg-message "this context" }
Index: testsuite/g++.dg/parse/access3.C
===================================================================
--- testsuite/g++.dg/parse/access3.C	(revision 221865)
+++ testsuite/g++.dg/parse/access3.C	(working copy)
@@ -10,5 +10,5 @@ class A {
 };
 
 class B {
-  friend void A::f();	// { dg-error "context" }
+  friend void A::f();	// { dg-message "context" }
 };
Index: testsuite/g++.dg/parse/access4.C
===================================================================
--- testsuite/g++.dg/parse/access4.C	(revision 221865)
+++ testsuite/g++.dg/parse/access4.C	(working copy)
@@ -14,7 +14,7 @@ class A {
 class B : public A {
   void bar() {
     A a;
-    void (A::*pmf)() = &A::foo;	// { dg-error "this context" }
+    void (A::*pmf)() = &A::foo;	// { dg-message "this context" }
     (a.*pmf)();
   }
 };
Index: testsuite/g++.dg/parse/access5.C
===================================================================
--- testsuite/g++.dg/parse/access5.C	(revision 221865)
+++ testsuite/g++.dg/parse/access5.C	(working copy)
@@ -13,6 +13,6 @@ struct A
 struct B : A 
 {
   void foo() {
-    (void)&A::a;		// { dg-error "this context" }
+    (void)&A::a;		// { dg-message "this context" }
   }
 };
Index: testsuite/g++.dg/parse/access6.C
===================================================================
--- testsuite/g++.dg/parse/access6.C	(revision 221865)
+++ testsuite/g++.dg/parse/access6.C	(working copy)
@@ -20,5 +20,5 @@ class B : public A
 int main()
 {
   B b;
-  return b.foo();		// { dg-error "this context" }
+  return b.foo();		// { dg-message "this context" }
 }
Index: testsuite/g++.dg/parse/access8.C
===================================================================
--- testsuite/g++.dg/parse/access8.C	(revision 221865)
+++ testsuite/g++.dg/parse/access8.C	(working copy)
@@ -5,8 +5,8 @@ class foo
   typedef int memfun;  // { dg-error "private" }
 };
 
-template<foo::memfun> // { dg-error "context" }
+template<foo::memfun> // { dg-message "context" }
 struct fm_obj { };
 
-template <typename T = foo::memfun> // { dg-error "context" }
+template <typename T = foo::memfun> // { dg-message "context" }
 struct S {};
Index: testsuite/g++.dg/parse/access9.C
===================================================================
--- testsuite/g++.dg/parse/access9.C	(revision 221865)
+++ testsuite/g++.dg/parse/access9.C	(working copy)
@@ -2,4 +2,4 @@
 
 class Foo { public:  typedef int type1; };
 class Bar { private: typedef Foo type2; }; // { dg-error "private" } 
-void g(Bar::type2::type1) {} // { dg-error "context" }
+void g(Bar::type2::type1) {} // { dg-message "context" }
Index: testsuite/g++.dg/parse/crash40.C
===================================================================
--- testsuite/g++.dg/parse/crash40.C	(revision 221865)
+++ testsuite/g++.dg/parse/crash40.C	(working copy)
@@ -26,13 +26,13 @@ template<bool> struct S {
   S(unsigned int = BBB::foo()->AAA::get()); /* { dg-error "is not a base of" } */
 };
 template<bool> struct SS {
-  SS(unsigned int = BBB::foo()->get()); /* { dg-error "within this context" } */
+  SS(unsigned int = BBB::foo()->get()); /* { dg-message "within this context" } */
 };
 
 void bar()
 {
   B().C::foo<0>(); /* { dg-error "is not a member of" } */
-  BB().AA::foo<0>(); /* { dg-error "within this context" } */
+  BB().AA::foo<0>(); /* { dg-message "within this context" } */
 
   int i;
   i.C::foo<0>(); /* { dg-error "which is of non-class type" } */
Index: testsuite/g++.dg/tc1/dr142.C
===================================================================
--- testsuite/g++.dg/tc1/dr142.C	(revision 221865)
+++ testsuite/g++.dg/tc1/dr142.C	(working copy)
@@ -16,8 +16,8 @@ class DD: public D {
 };
 
 void DD::f() {
-  mi = 3;          // { dg-error "within this context" "" }
-  si = 3;          // { dg-error "within this context" "" }
+  mi = 3;          // { dg-message "within this context" "" }
+  si = 3;          // { dg-message "within this context" "" }
   ::B b;
   b.mi = 3;
   b.si = 3;
@@ -27,6 +27,6 @@ void DD::f() {
   bp2->mi = 3;
 
 
-  B b2;                   // { dg-error "within this context" "" }
-  B::si = 3;              // { dg-error "within this context" "" }
+  B b2;                   // { dg-message "within this context" "" }
+  B::si = 3;              // { dg-message "within this context" "" }
 }
Index: testsuite/g++.dg/tc1/dr166.C
===================================================================
--- testsuite/g++.dg/tc1/dr166.C	(revision 221865)
+++ testsuite/g++.dg/tc1/dr166.C	(working copy)
@@ -24,11 +24,11 @@ namespace N {
 
     template <class T> void f(T)  // will be instantiated as f<long>
     {
-      M::A::x = 0;    // { dg-error "within this context" }
+      M::A::x = 0;    // { dg-message "within this context" }
       M::B::x = 0;
     }
     template <> void f<int>(int)
-    { M::A::x = 0; }      // { dg-error "within this context" }
+    { M::A::x = 0; }      // { dg-message "within this context" }
     template <> void f<double>(double )
     { 
       M::B::x = 0; 
@@ -41,8 +41,8 @@ namespace N {
 
   template <class T> void f(T)  // will be instantiated as f<long>
   { 
-    M::A::x = 0;       // { dg-error "within this context" }
-    M::B::x = 0;       // { dg-error "within this context" }
+    M::A::x = 0;       // { dg-message "within this context" }
+    M::B::x = 0;       // { dg-message "within this context" }
   }
 
   template <> void f<int>(int )
@@ -49,12 +49,12 @@ namespace N {
   { 
     N::f<long>(0);        // { dg-message "required" }
     M::A::x = 0; 
-    M::B::x = 0;       // { dg-error "within this context" }
+    M::B::x = 0;       // { dg-message "within this context" }
   }
 
   template <> void f<char>(char )
-  { M::A::x = 0; }      // { dg-error "within this context" }
+  { M::A::x = 0; }      // { dg-message "within this context" }
 
   void g(void)
-  { M::C::x = 0; }      // { dg-error "within this context" }
+  { M::C::x = 0; }      // { dg-message "within this context" }
 }
Index: testsuite/g++.dg/template/access11.C
===================================================================
--- testsuite/g++.dg/template/access11.C	(revision 221865)
+++ testsuite/g++.dg/template/access11.C	(working copy)
@@ -14,11 +14,11 @@ class X {
 };
 
 template <> struct X::Y<int> {
-  A::X x;			// { dg-error "this context" }
+  A::X x;			// { dg-message "this context" }
 };
 
 template <typename T> struct X::Y {
-  typename T::X x;		// { dg-error "this context" }
+  typename T::X x;		// { dg-message "this context" }
 };
 
 template struct X::Y<A>;	// { dg-message "required from here" }
Index: testsuite/g++.dg/template/access18.C
===================================================================
--- testsuite/g++.dg/template/access18.C	(revision 221865)
+++ testsuite/g++.dg/template/access18.C	(working copy)
@@ -7,13 +7,13 @@ class X {
   struct c; // { dg-error "private" }
 };
 
-template <typename = X::a> // { dg-error "context" }
+template <typename = X::a> // { dg-message "context" }
 struct A;
 
-template <int = X::b> // { dg-error "context" }
+template <int = X::b> // { dg-message "context" }
 struct B;
 
-template <template <typename> class T = X::c> // { dg-error "context" }
+template <template <typename> class T = X::c> // { dg-message "context" }
 struct C;
   
   
Index: testsuite/g++.dg/template/access19.C
===================================================================
--- testsuite/g++.dg/template/access19.C	(revision 221865)
+++ testsuite/g++.dg/template/access19.C	(working copy)
@@ -20,5 +20,5 @@ int foo( int x, explicit_t< int > y )
 
 int main()
 {
-        return foo( 5, 'c' ); /* { dg-error "this context" } */
+        return foo( 5, 'c' ); /* { dg-message "this context" } */
 }
Index: testsuite/g++.dg/template/access2.C
===================================================================
--- testsuite/g++.dg/template/access2.C	(revision 221865)
+++ testsuite/g++.dg/template/access2.C	(working copy)
@@ -4,8 +4,8 @@
 // Enforcing access of typename type.
 
 template <class T> struct A {
-  typename T::X x;			// { dg-error "this context" }
-  int f() { return T::i; }		// { dg-error "this context" }
+  typename T::X x;			// { dg-message "this context" }
+  int f() { return T::i; }		// { dg-message "this context" }
 };
 
 class B {
Index: testsuite/g++.dg/template/access20.C
===================================================================
--- testsuite/g++.dg/template/access20.C	(revision 221865)
+++ testsuite/g++.dg/template/access20.C	(working copy)
@@ -13,6 +13,6 @@ template <typename T> struct D : B<T>
 int main()
 {
         D<int> d;
-        d.v = 0;		// { dg-error "context" }
+        d.v = 0;		// { dg-message "context" }
         return 0;
 }
Index: testsuite/g++.dg/template/access26.C
===================================================================
--- testsuite/g++.dg/template/access26.C	(revision 221865)
+++ testsuite/g++.dg/template/access26.C	(working copy)
@@ -3,4 +3,4 @@
 template < typename T >
 struct A { static int i; };
 class B { typedef int X; };	// { dg-error "private" }
-void f() { A<B::X>::i = 0; }	// { dg-error "this context" }
+void f() { A<B::X>::i = 0; }	// { dg-message "this context" }
Index: testsuite/g++.dg/template/access3.C
===================================================================
--- testsuite/g++.dg/template/access3.C	(revision 221865)
+++ testsuite/g++.dg/template/access3.C	(working copy)
@@ -4,7 +4,7 @@
 // Enforcing access of typename type.
 
 template <class T> struct A {
-  typename T::template X<int> x;	// { dg-error "this context" }
+  typename T::template X<int> x;	// { dg-message "this context" }
 };
 
 class B {
Index: testsuite/g++.dg/template/access7.C
===================================================================
--- testsuite/g++.dg/template/access7.C	(revision 221865)
+++ testsuite/g++.dg/template/access7.C	(working copy)
@@ -9,7 +9,7 @@ class S {
 };
 
 template <typename A>
-typename A::T* f (A) {			// { dg-error "this context" }
+typename A::T* f (A) {			// { dg-message "this context" }
   return 0;
 }
 
Index: testsuite/g++.dg/template/conv12.C
===================================================================
--- testsuite/g++.dg/template/conv12.C	(revision 221865)
+++ testsuite/g++.dg/template/conv12.C	(working copy)
@@ -21,5 +21,5 @@ struct C2
   operator bool() { return false; }
 } c2;
 
-int ic2 = c2;			// { dg-error "" }
-int ac2 = c2 + c2;		// { dg-error "" }
+int ic2 = c2;			// { dg-message "" }
+int ac2 = c2 + c2;		// { dg-message "" }
Index: testsuite/g++.dg/template/friend31.C
===================================================================
--- testsuite/g++.dg/template/friend31.C	(revision 221865)
+++ testsuite/g++.dg/template/friend31.C	(working copy)
@@ -15,7 +15,7 @@ class W
 
 template <typename T, typename U> struct F
 {
-  void Look(W& w) { w.x = 3; }          // { dg-error "within this context" }
+  void Look(W& w) { w.x = 3; }          // { dg-message "within this context" }
 };
 
 int main()
Index: testsuite/g++.dg/template/friend32.C
===================================================================
--- testsuite/g++.dg/template/friend32.C	(revision 221865)
+++ testsuite/g++.dg/template/friend32.C	(working copy)
@@ -12,7 +12,7 @@ template<class T> class A
 
 template<class T> class B
 {
-  friend void A<T>::f ();	// { dg-error "this context" }
+  friend void A<T>::f ();	// { dg-message "this context" }
 };
 
 int f ()
Index: testsuite/g++.dg/template/memfriend15.C
===================================================================
--- testsuite/g++.dg/template/memfriend15.C	(revision 221865)
+++ testsuite/g++.dg/template/memfriend15.C	(working copy)
@@ -24,7 +24,7 @@ class C {
 template<class T> void A<T>::B2::f()
 {
   C c;
-  c.i = 0;	// { dg-error "context" }
+  c.i = 0;	// { dg-message "context" }
 }
 
 int main()
Index: testsuite/g++.dg/template/memfriend16.C
===================================================================
--- testsuite/g++.dg/template/memfriend16.C	(revision 221865)
+++ testsuite/g++.dg/template/memfriend16.C	(working copy)
@@ -24,7 +24,7 @@ class C {
 template<class T> template <class U> void A<T>::B2<U>::f()
 {
   C c;
-  c.i = 0;	// { dg-error "context" }
+  c.i = 0;	// { dg-message "context" }
 }
 
 int main()
Index: testsuite/g++.dg/template/memfriend17.C
===================================================================
--- testsuite/g++.dg/template/memfriend17.C	(revision 221865)
+++ testsuite/g++.dg/template/memfriend17.C	(working copy)
@@ -39,7 +39,7 @@ void A<T>::B::func1(void)
 template <typename T>
 void A<T>::B::func2(void)
 {
-    (void)F1<T*>::foo;	// { dg-error "context" }
+    (void)F1<T*>::foo;	// { dg-message "context" }
     (void)F2<T*>::foo;
 }
 
Index: testsuite/g++.dg/template/memfriend7.C
===================================================================
--- testsuite/g++.dg/template/memfriend7.C	(revision 221865)
+++ testsuite/g++.dg/template/memfriend7.C	(working copy)
@@ -36,31 +36,31 @@ template <class T> struct A<T*> {
 template <class T> void A<T*>::f(int)
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <class T> template <class U> void A<T*>::g()
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <class T> int A<T*>::h()
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <class T> void A<T*>::i(char)
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <class T> template <int> void A<T*>::j()
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <> struct A<char> {
@@ -74,43 +74,43 @@ template <> struct A<char> {
 void A<char>::f(int)
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <class U> void A<char>::g()
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <> void A<char>::g<int>()
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 int A<char>::h()
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 void A<char>::i(char)
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <int> void A<char>::j()
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 template <> void A<char>::j<0>()
 {
   C c;
-  c.ii = 0;				// { dg-error "context" }
+  c.ii = 0;				// { dg-message "context" }
 }
 
 int main()
Index: testsuite/g++.dg/template/pr32519.C
===================================================================
--- testsuite/g++.dg/template/pr32519.C	(revision 221865)
+++ testsuite/g++.dg/template/pr32519.C	(working copy)
@@ -11,6 +11,6 @@ struct D : public B
 {
   void g (B* b)
   {
-    b->f<int> (); // { dg-error "context" }
+    b->f<int> (); // { dg-message "context" }
   }
 };
Index: testsuite/g++.dg/template/qualttp21.C
===================================================================
--- testsuite/g++.dg/template/qualttp21.C	(revision 221865)
+++ testsuite/g++.dg/template/qualttp21.C	(working copy)
@@ -13,5 +13,5 @@ class foo {
 
 int main()
 {
-  foo<int> a; // { dg-error "context" }
+  foo<int> a; // { dg-message "context" }
 }
Index: testsuite/g++.dg/template/qualttp8.C
===================================================================
--- testsuite/g++.dg/template/qualttp8.C	(revision 221865)
+++ testsuite/g++.dg/template/qualttp8.C	(working copy)
@@ -6,7 +6,7 @@ template <template <class> class TT> class C {
 };
 
 template <class T> struct D {
-	C<T::template B> c; // { dg-error "context" }
+	C<T::template B> c; // { dg-message "context" }
 };
 
 struct E {
Index: testsuite/g++.dg/template/ttp10.C
===================================================================
--- testsuite/g++.dg/template/ttp10.C	(revision 221865)
+++ testsuite/g++.dg/template/ttp10.C	(working copy)
@@ -16,6 +16,6 @@ struct B {
 class E : protected B<Template> {}; 
  
 void bar() {
-  E::foo1 (0);				// { dg-error "context" }
-  E::foo2 (0);				// { dg-error "context" }
+  E::foo1 (0);				// { dg-message "context" }
+  E::foo2 (0);				// { dg-message "context" }
 }
Index: testsuite/g++.dg/template/typedef11.C
===================================================================
--- testsuite/g++.dg/template/typedef11.C	(revision 221865)
+++ testsuite/g++.dg/template/typedef11.C	(working copy)
@@ -18,8 +18,8 @@ template <int>
 int
 bar ()
 {
-  Beta<0>::Y i = 0;		// { dg-error "within this context" }
-  return Alpha::X ();		// { dg-error "within this context" }
+  Beta<0>::Y i = 0;		// { dg-message "within this context" }
+  return Alpha::X ();		// { dg-message "within this context" }
 }
 
 int i = bar<0> ();
Index: testsuite/g++.dg/template/typedef13.C
===================================================================
--- testsuite/g++.dg/template/typedef13.C	(revision 221865)
+++ testsuite/g++.dg/template/typedef13.C	(working copy)
@@ -9,7 +9,7 @@ class A
 
 template <class T> class B : public A
 {
-  mytype mem; // { dg-error "within this context"  }
+  mytype mem; // { dg-message "within this context"  }
 };
 
 B<int> b; // { dg-message "required from here" }
Index: testsuite/g++.dg/template/typedef19.C
===================================================================
--- testsuite/g++.dg/template/typedef19.C	(revision 221865)
+++ testsuite/g++.dg/template/typedef19.C	(working copy)
@@ -15,7 +15,7 @@ class B : public A
 template<class T>
 class B<T*> : public A
 {
-  mytype mem; // { dg-error "within this context" }
+  mytype mem; // { dg-message "within this context" }
 };
 
 B<int*> b;
Index: testsuite/g++.dg/template/typedef20.C
===================================================================
--- testsuite/g++.dg/template/typedef20.C	(revision 221865)
+++ testsuite/g++.dg/template/typedef20.C	(working copy)
@@ -20,7 +20,7 @@ template<typename T>
 struct y<T*> : public x
 {
   typedef x::type good;
-  typedef x::privtype bad; // { dg-error "within this context" }
+  typedef x::privtype bad; // { dg-message "within this context" }
 };
 
 template class y<int>;
Index: testsuite/g++.dg/template/typedef22.C
===================================================================
--- testsuite/g++.dg/template/typedef22.C	(revision 221865)
+++ testsuite/g++.dg/template/typedef22.C	(working copy)
@@ -11,7 +11,7 @@ struct B
 
 template <typename T>
 struct A : B<T> {
-  typedef typename B<char>::M N; // { dg-error "context" }
+  typedef typename B<char>::M N; // { dg-message "context" }
   A (int = N ());
 };
 
Index: testsuite/g++.dg/template/using16.C
===================================================================
--- testsuite/g++.dg/template/using16.C	(revision 221865)
+++ testsuite/g++.dg/template/using16.C	(working copy)
@@ -22,7 +22,7 @@ struct C : A<T>, B<T>
 
     void f()
     {
-	type j; // { dg-error "context" }
+	type j; // { dg-message "context" }
     }
 };
 
Index: testsuite/g++.dg/template/virtual3.C
===================================================================
--- testsuite/g++.dg/template/virtual3.C	(revision 221865)
+++ testsuite/g++.dg/template/virtual3.C	(working copy)
@@ -7,5 +7,5 @@ template<int> class A
 
 struct B : A<0>, A<1>		// { dg-error "deleted|context" }
 {
-  B() {}			// { dg-error "context" }
+  B() {}			// { dg-message "context" }
 };
Index: testsuite/g++.dg/ubsan/pr61272.C
===================================================================
--- testsuite/g++.dg/ubsan/pr61272.C	(revision 221865)
+++ testsuite/g++.dg/ubsan/pr61272.C	(working copy)
@@ -12,7 +12,7 @@ namespace std
   };
   namespace __gnu_cxx
   {
-    template < typename _Alloc > struct __alloc_traits:std::allocator_traits < _Alloc > // { dg-error "within this context" }
+    template < typename _Alloc > struct __alloc_traits:std::allocator_traits < _Alloc > // { dg-message "within this context" }
     {
       typedef std::allocator_traits < _Alloc > _Base_type;
       using _Base_type::construct;
Index: testsuite/g++.old-deja/g++.bob/inherit2.C
===================================================================
--- testsuite/g++.old-deja/g++.bob/inherit2.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.bob/inherit2.C	(working copy)
@@ -10,7 +10,7 @@ class A {
   const A& operator =(const A &) { abort(); }
 };
 
-class B : public A { // { dg-error "" }
+class B : public A { // { dg-message "" }
 public:
   B(void) {}
 };
Index: testsuite/g++.old-deja/g++.brendan/crash11.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/crash11.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.brendan/crash11.C	(working copy)
@@ -14,7 +14,7 @@ class A {
 
 class B : public A {
     public:
-	virtual void f1() { printf("i=%d j=%d\n",i,j); }// { dg-error "" }  member.*// ERROR -  member.*
+	virtual void f1() { printf("i=%d j=%d\n",i,j); }// { dg-message "" }  member.*// ERROR -  member.*
 	friend virtual void f2() { printf("i=%d j=%d\n",i,j); }// { dg-error "" }  virtual.*// ERROR -  member.*// ERROR -  member.*
 };
 
Index: testsuite/g++.old-deja/g++.brendan/enum6.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/enum6.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.brendan/enum6.C	(working copy)
@@ -11,6 +11,6 @@ void h(X* p) {
     X::E2 e2;
     int x2 = X::a2;
 
-    X::E1 e1;	     // { dg-error "" } within this context
-    int x1 = X::a1;  // { dg-error "" } within this context
+    X::E1 e1;	     // { dg-message "" } within this context
+    int x1 = X::a1;  // { dg-message "" } within this context
     }
Index: testsuite/g++.old-deja/g++.brendan/visibility1.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility1.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.brendan/visibility1.C	(working copy)
@@ -12,5 +12,5 @@ class bar : public foo {
 
 void baz (foo *f)
 {
-  f->i = 1;	// error: i is protected// { dg-error "" } .*
+  f->i = 1;	// error: i is protected// { dg-message "" } .*
 }
Index: testsuite/g++.old-deja/g++.brendan/visibility10.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility10.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.brendan/visibility10.C	(working copy)
@@ -9,6 +9,6 @@ struct base
 struct derived : public base
 {
     protected:
-        void derived_func(base *ptr) { ptr->base_func(); }// { dg-error "" }  within this context
+        void derived_func(base *ptr) { ptr->base_func(); }// { dg-message "" }  within this context
 };
 
Index: testsuite/g++.old-deja/g++.brendan/visibility2.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility2.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.brendan/visibility2.C	(working copy)
@@ -6,5 +6,5 @@ class X {
   void g (double);
 };
 	
-class Y : public X { void f() { g (1); } }; // { dg-error "" } private
+class Y : public X { void f() { g (1); } }; // { dg-message "" } private
 
Index: testsuite/g++.old-deja/g++.brendan/visibility6.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility6.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.brendan/visibility6.C	(working copy)
@@ -13,5 +13,5 @@ class middle : private bottom
 class top : public middle
 {
 public:
-  void bar () { b; }// { dg-error "" } .*
+  void bar () { b; }// { dg-message "" } .*
 };
Index: testsuite/g++.old-deja/g++.brendan/visibility8.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility8.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.brendan/visibility8.C	(working copy)
@@ -11,5 +11,5 @@ class foo1 : private foo
 { };
 class foo2 : public foo1
 { public:
-  void bar () { y; }// { dg-error "" } .*
+  void bar () { y; }// { dg-message "" } .*
 };
Index: testsuite/g++.old-deja/g++.bugs/900428_03.C
===================================================================
--- testsuite/g++.old-deja/g++.bugs/900428_03.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.bugs/900428_03.C	(working copy)
@@ -25,7 +25,7 @@ struct struct_1 : public struct_0 {
   struct_1 ();
 };
 
-struct_1::struct_1 () : struct_0 (8,9) // { dg-error "within this context" }
+struct_1::struct_1 () : struct_0 (8,9) // { dg-message "within this context" }
 {
 }
 
@@ -35,7 +35,7 @@ struct struct_2 {
   struct_2 ();
 };
 
-struct_2::struct_2 () : struct_2_data_member (8,9) // { dg-error "within this context" }
+struct_2::struct_2 () : struct_2_data_member (8,9) // { dg-message "within this context" }
 {
 }
 
Index: testsuite/g++.old-deja/g++.jason/access17.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access17.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.jason/access17.C	(working copy)
@@ -12,8 +12,8 @@ struct B: public A {
   static int (A::*fp)();
 };
 
-int A::* B::p = &A::i;         // { dg-error "" } 
-int (A::* B::fp)() = &A::f;    // { dg-error "" }
+int A::* B::p = &A::i;         // { dg-message "" } 
+int (A::* B::fp)() = &A::f;    // { dg-message "" }
 
 struct C {
   static int A::*p;
@@ -20,5 +20,5 @@ struct C {
   static int (A::*fp)();
 };
 
-int A::* C::p = &A::i;		// { dg-error "" } 
-int (A::* C::fp)() = &A::f;	// { dg-error "" } 
+int A::* C::p = &A::i;		// { dg-message "" } 
+int (A::* C::fp)() = &A::f;	// { dg-message "" } 
Index: testsuite/g++.old-deja/g++.jason/access18.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access18.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.jason/access18.C	(working copy)
@@ -12,9 +12,9 @@ class A {
     
 class B : public A {
   public:
-    B(): A() {}			// { dg-error "" } 
-    B(const B&) {}		// { dg-error "" } 
-    ~B() { }			// { dg-error "" } private dtor
+    B(): A() {}			// { dg-message "" } 
+    B(const B&) {}		// { dg-message "" } 
+    ~B() { }			// { dg-message "" } private dtor
 };
 
 main()
Index: testsuite/g++.old-deja/g++.jason/access22.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access22.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.jason/access22.C	(working copy)
@@ -12,7 +12,7 @@ class A
 
 struct B : public A
 {
-    void func() { foo(); }	// { dg-error "" } 
+    void func() { foo(); }	// { dg-message "" } 
 };
 
 int main()
Index: testsuite/g++.old-deja/g++.jason/access23.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access23.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.jason/access23.C	(working copy)
@@ -50,11 +50,11 @@ struct Bar : public Foo {
     PRT_A = 0;
     PRT.B = 0;		
     printf("%x\n",Foo::PRT.pY);	
-    PRV_A = 0;			// { dg-error "" } 
-    Foo::C = 0;			// { dg-error "" } 
-    printf("%x\n",pZ);  	// { dg-error "" } 
-    Foo::PRV.C = 0;		// { dg-error "" } 
-    printf("%x\n",PRV.pZ); 	// { dg-error "" } 
+    PRV_A = 0;			// { dg-message "" } 
+    Foo::C = 0;			// { dg-message "" } 
+    printf("%x\n",pZ);  	// { dg-message "" } 
+    Foo::PRV.C = 0;		// { dg-message "" } 
+    printf("%x\n",PRV.pZ); 	// { dg-message "" } 
   }
 };
 
@@ -65,16 +65,16 @@ int main()
   a.PUB_A = 0;
   a.A = 0;
   printf("%x\n",a.pX);  
-  a.PRT_A = 0;			// { dg-error "" } 
-  a.B = 0;			// { dg-error "" } 
-  printf("%x\n",a.pY);  	// { dg-error "" } 
-  a.PRV_A = 0;			// { dg-error "" } 
-  a.C = 0;			// { dg-error "" } 
-  printf("%x\n",a.pZ);  	// { dg-error "" } 
+  a.PRT_A = 0;			// { dg-message "" } 
+  a.B = 0;			// { dg-message "" } 
+  printf("%x\n",a.pY);  	// { dg-message "" } 
+  a.PRV_A = 0;			// { dg-message "" } 
+  a.C = 0;			// { dg-message "" } 
+  printf("%x\n",a.pZ);  	// { dg-message "" } 
   a.PUB.A = 0;
   printf("%x\n",a.PUB.pX);  
-  a.PRT.B = 0;			// { dg-error "" } 
-  printf("%x\n",a.PRT.pY);  	// { dg-error "" } 
-  a.PRV.C = 0;			// { dg-error "" } 
-  printf("%x\n",a.PRV.pZ);  	// { dg-error "" } 
+  a.PRT.B = 0;			// { dg-message "" } 
+  printf("%x\n",a.PRT.pY);  	// { dg-message "" } 
+  a.PRV.C = 0;			// { dg-message "" } 
+  printf("%x\n",a.PRV.pZ);  	// { dg-message "" } 
 }
Index: testsuite/g++.old-deja/g++.jason/delete3.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/delete3.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.jason/delete3.C	(working copy)
@@ -15,5 +15,5 @@ A::~A()
 
 void foo(A *p)
 {
-  delete p;			// { dg-error "" } in this context
+  delete p;			// { dg-message "" } in this context
 }
Index: testsuite/g++.old-deja/g++.jason/report.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/report.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.jason/report.C	(working copy)
@@ -50,9 +50,9 @@ typedef int const * bart ();
 typedef bart const * const * bar2;
 typedef bart volatile * const * bar2v;
 
-bar2 baz (X::Y y)	        // { dg-error "" } in this context
+bar2 baz (X::Y y)	        // { dg-message "" } in this context
 {
-  X::Y f;			// { dg-error "" } in this context
+  X::Y f;			// { dg-message "" } in this context
   bar2 wa [5];
   wa[0] = baz(f);
   undef2 (1); // { dg-error "" } implicit declaration
Index: testsuite/g++.old-deja/g++.law/access2.C
===================================================================
--- testsuite/g++.old-deja/g++.law/access2.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/access2.C	(working copy)
@@ -16,5 +16,5 @@ template <class T> class Foo
 
 int main()
 {
-    Foo<int>(1);// { dg-error "" } 
+    Foo<int>(1);// { dg-message "" } 
 }
Index: testsuite/g++.old-deja/g++.law/access3.C
===================================================================
--- testsuite/g++.old-deja/g++.law/access3.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/access3.C	(working copy)
@@ -12,5 +12,5 @@
           void g (double);
         };
 
-        class Y : public X { void f() { g (1); } };// { dg-error "" } 
+        class Y : public X { void f() { g (1); } };// { dg-message "" } 
 
Index: testsuite/g++.old-deja/g++.law/access4.C
===================================================================
--- testsuite/g++.old-deja/g++.law/access4.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/access4.C	(working copy)
@@ -19,9 +19,9 @@ class Sterile : private virtual ForceLeafSterile {
 
 class Illegitimate : public Sterile {
 public:
-    Illegitimate() {}           // { dg-error "" }  can't access virtual base deflt ctor
+    Illegitimate() {}           // { dg-message "" }  can't access virtual base deflt ctor
     Illegitimate(const char* /*blah*/)
-        : ForceLeafSterile() {} // { dg-error "" } can't access default ctor
+        : ForceLeafSterile() {} // { dg-message "" } can't access default ctor
     Illegitimate(const Illegitimate&)
-        {}                      // { dg-error "" } can't access default ctor
+        {}                      // { dg-message "" } can't access default ctor
 };
Index: testsuite/g++.old-deja/g++.law/access5.C
===================================================================
--- testsuite/g++.old-deja/g++.law/access5.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/access5.C	(working copy)
@@ -19,6 +19,6 @@ class enclose {
 class derived : public enclose {
   nested_public obj1;     // ok
   nested_protected obj2;  // ok
-  nested_private obj3;    // error// { dg-error "" } in this context
+  nested_private obj3;    // error// { dg-message "" } in this context
 };
 
Index: testsuite/g++.old-deja/g++.law/arm12.C
===================================================================
--- testsuite/g++.old-deja/g++.law/arm12.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/arm12.C	(working copy)
@@ -32,7 +32,7 @@ void X::f()
   std::cout << "X::f()" << std::endl;
 }
 
-Y::Y() // { dg-error "within this context" }
+Y::Y() // { dg-message "within this context" }
 {
   std::cout << "Y::Y()" << std::endl;
 }
Index: testsuite/g++.old-deja/g++.law/arm14.C
===================================================================
--- testsuite/g++.old-deja/g++.law/arm14.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/arm14.C	(working copy)
@@ -18,7 +18,7 @@ void h(X* p) {
     X::E2 e2;
     int x2 = X::a2;
 
-    X::E1 e1;                   // { dg-error "" } within this context
-    int x1 = X::a1;             // { dg-error "" } Should be rejected, and is.
+    X::E1 e1;                   // { dg-message "" } within this context
+    int x1 = X::a1;             // { dg-message "" } Should be rejected, and is.
     }
 
Index: testsuite/g++.old-deja/g++.law/ctors13.C
===================================================================
--- testsuite/g++.old-deja/g++.law/ctors13.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/ctors13.C	(working copy)
@@ -7,7 +7,7 @@ class A {
 };
 
 int main() {
-  A* a = new A();// { dg-error "" } .*
+  A* a = new A();// { dg-message "" } .*
   if (a) {
      std::cout << "a != NULL\n";
   } else {
Index: testsuite/g++.old-deja/g++.law/union2.C
===================================================================
--- testsuite/g++.old-deja/g++.law/union2.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/union2.C	(working copy)
@@ -20,6 +20,6 @@ void f() {
   A a;
 
   a.x = 0;
-  a.y = 1;// { dg-error "" } .*
-  a.z = 2;// { dg-error "" } 
+  a.y = 1;// { dg-message "" } .*
+  a.z = 2;// { dg-message "" } 
 }
Index: testsuite/g++.old-deja/g++.law/visibility12.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility12.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility12.C	(working copy)
@@ -13,6 +13,6 @@ class b : private a {
         };
 
 class c : public b {
-        int xx(void) { return (aa); }  // aa should be invisible// { dg-error "" } .*
+        int xx(void) { return (aa); }  // aa should be invisible// { dg-message "" } .*
         };
 
Index: testsuite/g++.old-deja/g++.law/visibility15.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility15.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility15.C	(working copy)
@@ -21,5 +21,5 @@ class X {
 
 int main(void)
 {
-  X* p = new X;// { dg-error "" } .*
+  X* p = new X;// { dg-message "" } .*
 }
Index: testsuite/g++.old-deja/g++.law/visibility16.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility16.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility16.C	(working copy)
@@ -17,7 +17,7 @@ class B : public A {
     int bstuff;
   public:
     B( A *p) {
-        bstuff = p->astuff;// { dg-error "" } .*
+        bstuff = p->astuff;// { dg-message "" } .*
     }
 };
 
Index: testsuite/g++.old-deja/g++.law/visibility17.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility17.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility17.C	(working copy)
@@ -42,12 +42,12 @@ Base::Base(char* str) // { dg-error "is private" }
     name_ = std::strcpy(new char[std::strlen(str) + 1], str);
 }
 
-Derived::Derived(int n, char* str) : Base(str) // { dg-error "within this context" }
+Derived::Derived(int n, char* str) : Base(str) // { dg-message "within this context" }
 {
   num_ = n;
 }
 
-Derived::Derived(int n) : Base() // { dg-error "within this context" }
+Derived::Derived(int n) : Base() // { dg-message "within this context" }
 {
   num_ = n;
 }
Index: testsuite/g++.old-deja/g++.law/visibility18.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility18.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility18.C	(working copy)
@@ -15,6 +15,6 @@ struct T3 : public T1, private T2 {
 int main ()
 {
     x.i = 1;
-    x.j = 2;    // error: x.j is private// { dg-error "" } .*
+    x.j = 2;    // error: x.j is private// { dg-message "" } .*
     return 0;
 }
Index: testsuite/g++.old-deja/g++.law/visibility19.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility19.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility19.C	(working copy)
@@ -20,21 +20,21 @@ class D2 : public B {
 
 void fr(B* pb, D1* p1, D2* p2)
 {
-    pb->i = 1;  // illegal// { dg-error "" } .*
-    p1->i = 2;  // illegal// { dg-error "" } .*
+    pb->i = 1;  // illegal// { dg-message "" } .*
+    p1->i = 2;  // illegal// { dg-message "" } .*
     p2->i = 3;  // ok (access through D2)
 }
 
 void D2::mem(B* pb, D1* p1)
 {
-    pb->i = 1;  // illegal// { dg-error "" } .*
-    p1->i = 2;  // illegal// { dg-error "" } .*
+    pb->i = 1;  // illegal// { dg-message "" } .*
+    p1->i = 2;  // illegal// { dg-message "" } .*
     i = 3;      // ok (access through `this')
 }
 
 void g(B* pb, D1* p1, D2* p2)
 {
-    pb->i = 1;  // illegal// { dg-error "" } .*
-    p1->i = 2;  // illegal// { dg-error "" } .*
-    p2->i = 3;  // illegal// { dg-error "" } .*
+    pb->i = 1;  // illegal// { dg-message "" } .*
+    p1->i = 2;  // illegal// { dg-message "" } .*
+    p2->i = 3;  // illegal// { dg-message "" } .*
 }
Index: testsuite/g++.old-deja/g++.law/visibility20.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility20.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility20.C	(working copy)
@@ -23,7 +23,7 @@ class Derived : public Base {
 
 void
 Derived::noticeThisFunction(Base *b) {
-    b->protectedBaseFunction(); // ARM says this is not allowed// { dg-error "" } .*
+    b->protectedBaseFunction(); // ARM says this is not allowed// { dg-message "" } .*
                                 // since it is not called on 'this'
 }
 
Index: testsuite/g++.old-deja/g++.law/visibility21.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility21.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility21.C	(working copy)
@@ -13,5 +13,5 @@ class A {
 class B : public A
 {
         void bar(A &a)
-                {       a.foo(); }// { dg-error "" } .*
+                {       a.foo(); }// { dg-message "" } .*
 };
Index: testsuite/g++.old-deja/g++.law/visibility4.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility4.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility4.C	(working copy)
@@ -20,6 +20,6 @@ extern "C" int printf( const char *, ...);
 
 class E : public C {
         void f() {
-                printf( "%d\n", b);// { dg-error "" } .*
+                printf( "%d\n", b);// { dg-message "" } .*
         }
 };
Index: testsuite/g++.old-deja/g++.law/visibility5.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility5.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility5.C	(working copy)
@@ -13,5 +13,5 @@ class a {
 void test ()
 {
   a *ap = new a;
-  a *ap2 = new a (3);// { dg-error "" } .*
+  a *ap2 = new a (3);// { dg-message "" } .*
 }
Index: testsuite/g++.old-deja/g++.law/visibility8.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility8.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility8.C	(working copy)
@@ -23,4 +23,4 @@ class t3 : public t2 {
 };
 
 
-int t3::ttt() { return a; }// { dg-error "" } .*
+int t3::ttt() { return a; }// { dg-message "" } .*
Index: testsuite/g++.old-deja/g++.law/visibility9.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility9.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.law/visibility9.C	(working copy)
@@ -18,5 +18,5 @@ class B : public A {
 
 
 void B::f1(A* pa) {
-    pa->a = 1;    // illegal but allowed by gcc// { dg-error "" } .*
+    pa->a = 1;    // illegal but allowed by gcc// { dg-message "" } .*
 }
Index: testsuite/g++.old-deja/g++.niklas/t135.C
===================================================================
--- testsuite/g++.old-deja/g++.niklas/t135.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.niklas/t135.C	(working copy)
@@ -16,7 +16,7 @@ class C2 C2_object;
 
 template <class T> void C1<T>::diddle_C2 ()
 {
-  C2_object.data_member = 99; // { dg-error "" }
+  C2_object.data_member = 99; // { dg-message "" }
 }
 
 C1<int> C1_int_object;
Index: testsuite/g++.old-deja/g++.oliva/delete1.C
===================================================================
--- testsuite/g++.old-deja/g++.oliva/delete1.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.oliva/delete1.C	(working copy)
@@ -18,7 +18,7 @@ struct foo {
 
 struct bar : foo {
   ~bar() {
-    delete this; // { dg-error "" } delete is private
+    delete this; // { dg-message "" } delete is private
     // An implicit invocation of delete is emitted in destructors, but
     // it should only be checked in virtual destructors
   } // { dg-bogus "" } not virtual
@@ -25,7 +25,7 @@ struct bar : foo {
 } bar_;
 
 struct baz : foo {
-  virtual ~baz() {} // { dg-error "" } delete is private in vdtor
+  virtual ~baz() {} // { dg-message "" } delete is private in vdtor
 } baz_;
 
 struct bad : baz {} bad_; // { dg-message "" } delete is private in vdtor
Index: testsuite/g++.old-deja/g++.oliva/partord1.C
===================================================================
--- testsuite/g++.old-deja/g++.oliva/partord1.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.oliva/partord1.C	(working copy)
@@ -17,7 +17,7 @@ template <typename T> void foo(T) {
   bar<T>().i; // ok, I'm a friend
 }
 template <typename T> void foo(T*) {
-  bar<T*>().i; // { dg-error "" } not a friend
+  bar<T*>().i; // { dg-message "" } not a friend
 }
 
 int main() {
Index: testsuite/g++.old-deja/g++.other/access11.C
===================================================================
--- testsuite/g++.old-deja/g++.other/access11.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/access11.C	(working copy)
@@ -16,5 +16,5 @@ int main()
 {
   A a;
  
-  a.g<int>(0); // { dg-error "" } private
+  a.g<int>(0); // { dg-message "" } private
 }
Index: testsuite/g++.old-deja/g++.other/access4.C
===================================================================
--- testsuite/g++.old-deja/g++.other/access4.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/access4.C	(working copy)
@@ -7,5 +7,5 @@ struct A { // { dg-error "" } inaccessible
 struct B : private A { };
 
 struct C : public B {
-  int f () { return A::i; } // { dg-error "" } context
+  int f () { return A::i; } // { dg-message "" } context
 };
Index: testsuite/g++.old-deja/g++.other/access7.C
===================================================================
--- testsuite/g++.old-deja/g++.other/access7.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/access7.C	(working copy)
@@ -19,8 +19,8 @@ class D: public A {
 
 void D::E::f ()
 {
-  int i = I1;			// { dg-error "" } within this context
-  B1 b1;			// { dg-error "" } within this context
+  int i = I1;			// { dg-message "" } within this context
+  B1 b1;			// { dg-message "" } within this context
   i = I2;
   B2 b2;
 }
@@ -27,7 +27,7 @@ void D::E::f ()
 
 void f ()
 {
-  A::B1 b1;			// { dg-error "" } within this context
-  new A::B1;			// { dg-error "" } within this context
-  (A::B1) b1;			// { dg-error "" } within this context
+  A::B1 b1;			// { dg-message "" } within this context
+  new A::B1;			// { dg-message "" } within this context
+  (A::B1) b1;			// { dg-message "" } within this context
 }
Index: testsuite/g++.old-deja/g++.other/crash7.C
===================================================================
--- testsuite/g++.old-deja/g++.other/crash7.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/crash7.C	(working copy)
@@ -7,5 +7,5 @@ void f()
     int i; // { dg-error "" } private
   } u;
 
-  u.i = 3; // { dg-error "" } within this context
+  u.i = 3; // { dg-message "" } within this context
 }
Index: testsuite/g++.old-deja/g++.other/friend1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/friend1.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/friend1.C	(working copy)
@@ -51,7 +51,7 @@ D d;
 
 void f()
 {
-    b.i = 3; // { dg-error "" } protected
+    b.i = 3; // { dg-message "" } protected
     d.i = 4;
     B::j = 5;
     D::j = 6;
@@ -60,7 +60,7 @@ void f()
 template <typename T>
 void g()
 {
-    b.i = 3; // { dg-error "" } protected
+    b.i = 3; // { dg-message "" } protected
     d.i = 4;
     B::j = 5;
     D::j = 6;
@@ -70,7 +70,7 @@ template void g<int>();
 
 void S::h()
 {
-  b.i = 3; // { dg-error "" } protected
+  b.i = 3; // { dg-message "" } protected
   d.i = 4;
   B::j = 5;
   D::j = 6;
@@ -79,7 +79,7 @@ void S::h()
 template <typename T>
 void R<T>::h() 
 {
-  b.i = 3; // { dg-error "" } protected
+  b.i = 3; // { dg-message "" } protected
   d.i = 4;
   B::j = 5;
   D::j = 6;
Index: testsuite/g++.old-deja/g++.other/friend4.C
===================================================================
--- testsuite/g++.old-deja/g++.other/friend4.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/friend4.C	(working copy)
@@ -14,8 +14,8 @@ template <class C> class bar {
   template <class B> friend void foo<C,B>(); // { dg-error "" } bogus declaration
 };
 template <class A, class B> void foo() {
-  bar<A> baz; baz.i = 1;   // { dg-error "" } foo cannot access bar<int>::i
-  bar<int> buz; buz.i = 1; // { dg-error "" } foo cannot access bar<int>::i
+  bar<A> baz; baz.i = 1;   // { dg-message "" } foo cannot access bar<int>::i
+  bar<int> buz; buz.i = 1; // { dg-message "" } foo cannot access bar<int>::i
 }
 int main() {
   foo<void,void>();
Index: testsuite/g++.old-deja/g++.other/friend9.C
===================================================================
--- testsuite/g++.old-deja/g++.other/friend9.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/friend9.C	(working copy)
@@ -12,7 +12,7 @@ class F
 
 class C
 {
-  friend class F::Internal; // { dg-error "" } in this context
+  friend class F::Internal; // { dg-message "" } in this context
   public:
   typedef enum { A, B } e;
 
Index: testsuite/g++.old-deja/g++.other/lineno1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/lineno1.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/lineno1.C	(working copy)
@@ -9,7 +9,7 @@ class A
   ~A();				// { dg-error "" } private
 };
 
-static A a;			// { dg-error "" } here
+static A a;			// { dg-message "" } here
 
 
 
Index: testsuite/g++.old-deja/g++.other/using1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/using1.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.other/using1.C	(working copy)
@@ -10,7 +10,7 @@ class B {
   friend class D2;
 };
 
-class D : public B { // { dg-error "" } within this context
+class D : public B { // { dg-message "" } within this context
 public:
   using B::a;
   using B::b;
Index: testsuite/g++.old-deja/g++.pt/enum14.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/enum14.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.pt/enum14.C	(working copy)
@@ -30,7 +30,7 @@ struct B
 
 struct D: public B<int>
 {
-  void choke (foo);   // { dg-error "" } within this context
-  void choke (baz);   // { dg-error "" } within this context
+  void choke (foo);   // { dg-message "" } within this context
+  void choke (baz);   // { dg-message "" } within this context
 };
 
Index: testsuite/g++.old-deja/g++.pt/friend11.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/friend11.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.pt/friend11.C	(working copy)
@@ -9,7 +9,7 @@ struct S
   void f(U u)
     {
       C<U> cu;
-      cu.i = 3; // { dg-error "" } S<double>::f<U> is a friend, but this is
+      cu.i = 3; // { dg-message "" } S<double>::f<U> is a friend, but this is
                 //         S<int>::f<double>. 
     }
 };
Index: testsuite/g++.old-deja/g++.pt/friend21.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/friend21.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.pt/friend21.C	(working copy)
@@ -24,7 +24,7 @@ void A<T>::f()
   B<T>::i = 3;
   C<T>::i = 3;
   C<double>::i = 3;
-  B<double>::i = 3; // { dg-error "" } member `i' is private
+  B<double>::i = 3; // { dg-message "" } member `i' is private
 }
 
 template void A<int>::f();
Index: testsuite/g++.old-deja/g++.pt/friend3.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/friend3.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.pt/friend3.C	(working copy)
@@ -15,7 +15,7 @@ template <class T>
 void f(T)
 {
   C c;
-  c.i = 3; // { dg-error "" } f<double> is a friend, this is f<int>.
+  c.i = 3; // { dg-message "" } f<double> is a friend, this is f<int>.
 }
 
 
Index: testsuite/g++.old-deja/g++.pt/inherit2.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/inherit2.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.pt/inherit2.C	(working copy)
@@ -41,7 +41,7 @@ template <class T> struct A<T>::AC
 {
   T M ()
   {
-    return B<T>::valueA_AC;	// { dg-error "" "" } within this context - 
+    return B<T>::valueA_AC;	// { dg-message "" "" } within this context - 
   }
 };
 
Index: testsuite/g++.old-deja/g++.pt/memtemp74.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/memtemp74.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.pt/memtemp74.C	(working copy)
@@ -16,6 +16,6 @@ class S
 void f()
 {
   S<double> s;
-  s.f(3); // { dg-error "" } within this context
-  s.g(2.0); // { dg-error "" } within this context
+  s.f(3); // { dg-message "" } within this context
+  s.g(2.0); // { dg-message "" } within this context
 }
Index: testsuite/g++.old-deja/g++.pt/memtemp89.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/memtemp89.C	(revision 221865)
+++ testsuite/g++.old-deja/g++.pt/memtemp89.C	(working copy)
@@ -12,4 +12,4 @@ template<template<class> class XX>
 class Y {
 	XX<int> x_;
 };
-Y<Q::X> y;			// { dg-error "" } required from here
+Y<Q::X> y;			// { dg-message "" } required from here

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] Emit error + inform for access control issues
  2015-04-04 13:00 [C++ Patch] Emit error + inform for access control issues Paolo Carlini
@ 2015-04-06 14:07 ` Jason Merrill
  2015-04-07  9:35   ` Paolo Carlini
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Merrill @ 2015-04-06 14:07 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches

On 04/04/2015 09:00 AM, Paolo Carlini wrote:
>  	    error ("%q+#D is inaccessible", diag_decl);
> -	  error ("within this context");
> +	  inform (input_location, "within this context");

This is the wrong error to change to inform; we want the error to be 
associated with the point of use, not the declaration of the member.

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] Emit error + inform for access control issues
  2015-04-06 14:07 ` Jason Merrill
@ 2015-04-07  9:35   ` Paolo Carlini
  2015-04-07 15:19     ` Paolo Carlini
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Carlini @ 2015-04-07  9:35 UTC (permalink / raw)
  To: Jason Merrill, gcc-patches

Hi,

On 04/06/2015 04:07 PM, Jason Merrill wrote:
> On 04/04/2015 09:00 AM, Paolo Carlini wrote:
>>          error ("%q+#D is inaccessible", diag_decl);
>> -      error ("within this context");
>> +      inform (input_location, "within this context");
>
> This is the wrong error to change to inform; we want the error to be 
> associated with the point of use, not the declaration of the member.
Yeah, I see what you mean. That requires a rewording however, let me see...

Paolo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] Emit error + inform for access control issues
  2015-04-07  9:35   ` Paolo Carlini
@ 2015-04-07 15:19     ` Paolo Carlini
  2015-04-15  8:48       ` Paolo Carlini
  2015-04-15 13:21       ` Jason Merrill
  0 siblings, 2 replies; 6+ messages in thread
From: Paolo Carlini @ 2015-04-07 15:19 UTC (permalink / raw)
  To: Jason Merrill, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

... thus I prepared the below. I tried to minimize the diagnostic 
changes but a few more testcases needed tweaking anyway.

Thanks!
Paolo.

///////////////////////

[-- Attachment #2: patch_access_error_inform_2 --]
[-- Type: text/plain, Size: 62269 bytes --]

Index: cp/call.c
===================================================================
--- cp/call.c	(revision 221871)
+++ cp/call.c	(working copy)
@@ -6020,12 +6020,22 @@ enforce_access (tree basetype_path, tree decl, tre
       if (complain & tf_error)
 	{
 	  if (TREE_PRIVATE (decl))
-	    error ("%q+#D is private", diag_decl);
+	    {
+	      error ("%q#D is private within this context", diag_decl);
+	      inform (DECL_SOURCE_LOCATION (diag_decl),
+		      "declared private here");
+	    }
 	  else if (TREE_PROTECTED (decl))
-	    error ("%q+#D is protected", diag_decl);
+	    {
+	      error ("%q#D is protected within this context", diag_decl);
+	      inform (DECL_SOURCE_LOCATION (diag_decl),
+		      "declared protected here");
+	    }
 	  else
-	    error ("%q+#D is inaccessible", diag_decl);
-	  error ("within this context");
+	    {
+	      error ("%q#D is inaccessible within this context", diag_decl);
+	      inform (DECL_SOURCE_LOCATION (diag_decl), "declared here");
+	    }
 	}
       return false;
     }
Index: testsuite/g++.dg/cpp0x/alias-decl-22.C
===================================================================
--- testsuite/g++.dg/cpp0x/alias-decl-22.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/alias-decl-22.C	(working copy)
@@ -7,6 +7,6 @@ using foo = typename T::bar;	// { dg-error "this c
 
 class B
 {
-  typedef int bar;		// { dg-error "private" }
+  typedef int bar;		// { dg-message "private" }
   foo<B> f;			// { dg-message "required" }
 };
Index: testsuite/g++.dg/cpp0x/decltype-call1.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype-call1.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/decltype-call1.C	(working copy)
@@ -17,7 +17,7 @@ decltype(45,f(),42) g4b();	 // { dg-error "" }
 
 class B
 {
-  ~B();				// { dg-error "private" }
+  ~B();				// { dg-message "private" }
 public:
   int i;
   void operator[](int);
Index: testsuite/g++.dg/cpp0x/defaulted21.C
===================================================================
--- testsuite/g++.dg/cpp0x/defaulted21.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/defaulted21.C	(working copy)
@@ -4,7 +4,7 @@
 struct U {
   U();
 private:
-  U(U const&);			// { dg-error "private" }
+  U(U const&);			// { dg-message "private" }
 };
 
 struct X {
Index: testsuite/g++.dg/cpp0x/defaulted28.C
===================================================================
--- testsuite/g++.dg/cpp0x/defaulted28.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/defaulted28.C	(working copy)
@@ -6,7 +6,7 @@ struct A {
   A() = default;
 
 private:
-  A(A const&) = default;	// { dg-error "private" }
+  A(A const&) = default;	// { dg-message "private" }
 };
 
 int f(...) { }
Index: testsuite/g++.dg/cpp0x/defaulted47.C
===================================================================
--- testsuite/g++.dg/cpp0x/defaulted47.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/defaulted47.C	(working copy)
@@ -3,7 +3,7 @@
 
 class A
 {
-  A() = default;   // { dg-error "private" }
+  A() = default;   // { dg-message "private" }
 };
 
 A a;               // { dg-error "context" }
@@ -10,7 +10,7 @@ A a;               // { dg-error "context" }
 
 class B
 {
-  ~B() = default;  // { dg-error "private" }
+  ~B() = default;  // { dg-message "private" }
 };
 
 B b;               // { dg-error "context" }
Index: testsuite/g++.dg/cpp0x/elision_neg.C
===================================================================
--- testsuite/g++.dg/cpp0x/elision_neg.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/elision_neg.C	(working copy)
@@ -12,7 +12,7 @@ struct two   {char x[2];};
 
 class move_only
 {
-    move_only(const move_only&); // { dg-error "is private" }
+    move_only(const move_only&); // { dg-message "private" }
     move_only& operator=(const move_only&);
 public:
     move_only() {}
Index: testsuite/g++.dg/cpp0x/fntmpdefarg3.C
===================================================================
--- testsuite/g++.dg/cpp0x/fntmpdefarg3.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/fntmpdefarg3.C	(working copy)
@@ -8,7 +8,7 @@ template <class T, class = typename T::I> void j(T
 
 class A
 {
-  typedef int I;		// { dg-error "private" }
+  typedef int I;		// { dg-message "private" }
   template <class T, class> friend void f(T);
   friend void g<A,I>(A);
   friend void h<A>(A);
Index: testsuite/g++.dg/cpp0x/implicit-trivial1.C
===================================================================
--- testsuite/g++.dg/cpp0x/implicit-trivial1.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/implicit-trivial1.C	(working copy)
@@ -8,7 +8,7 @@ struct A
 {
   A() {}
 private:
-  template <class T> A(T&);	// { dg-error "private" }
+  template <class T> A(T&);	// { dg-message "private" }
 };
 
 struct B			// { dg-error "implicitly deleted|this context" }
Index: testsuite/g++.dg/cpp0x/implicit1.C
===================================================================
--- testsuite/g++.dg/cpp0x/implicit1.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/implicit1.C	(working copy)
@@ -5,7 +5,7 @@
 
 class C
 {
-  void operator delete (void *); // { dg-error "private" }
+  void operator delete (void *); // { dg-message "private" }
 public:
   virtual ~C();			// { dg-error "overriding" }
 };
Index: testsuite/g++.dg/cpp0x/implicit9.C
===================================================================
--- testsuite/g++.dg/cpp0x/implicit9.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/implicit9.C	(working copy)
@@ -5,7 +5,7 @@ struct A
 {
   A();
 private:
-  ~A();				// { dg-error "private" }
+  ~A();				// { dg-message "private" }
 };
 
 struct B: A { };		// { dg-error "implicitly deleted|context" }
Index: testsuite/g++.dg/cpp0x/inh-ctor9.C
===================================================================
--- testsuite/g++.dg/cpp0x/inh-ctor9.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/inh-ctor9.C	(working copy)
@@ -9,7 +9,7 @@ class A
 
 struct B: A
 {
-  using A::A;			// { dg-error "protected" }
+  using A::A;			// { dg-message "protected" }
 };
 
 B b(42);			// { dg-error "this context" }
Index: testsuite/g++.dg/cpp0x/range-for13.C
===================================================================
--- testsuite/g++.dg/cpp0x/range-for13.C	(revision 221871)
+++ testsuite/g++.dg/cpp0x/range-for13.C	(working copy)
@@ -28,8 +28,8 @@ struct container2
 struct container3
 {
 private:
-    int *begin(); // { dg-error "is private" }
-    int *end(); // { dg-error "is private" }
+    int *begin(); // { dg-message "private" }
+    int *end(); // { dg-message "private" }
 };
 
 struct container4
@@ -70,7 +70,7 @@ struct container8
 struct private_callable
 {
 private:
-    int *operator()(); // { dg-error "is private" }
+    int *operator()(); // { dg-message "private" }
 };
 
 struct container9
Index: testsuite/g++.dg/gomp/clause-2.C
===================================================================
--- testsuite/g++.dg/gomp/clause-2.C	(revision 221871)
+++ testsuite/g++.dg/gomp/clause-2.C	(working copy)
@@ -5,9 +5,9 @@ struct B { B(); };
 struct C { C(); C(const C&); };
 struct D { D& operator=(const D&); };
 
-class E { private: E(); public: E(int); };	// { dg-error "private" }
-class F { private: F(const F&); public: F(); };	// { dg-error "private" }
-class G { private: G& operator=(const G&); };	// { dg-error "private" }
+class E { private: E(); public: E(int); };	// { dg-message "private" }
+class F { private: F(const F&); public: F(); };	// { dg-message "private" }
+class G { private: G& operator=(const G&); };	// { dg-message "private" }
 
 void bar();
 void foo()
Index: testsuite/g++.dg/gomp/udr-5.C
===================================================================
--- testsuite/g++.dg/gomp/udr-5.C	(revision 221871)
+++ testsuite/g++.dg/gomp/udr-5.C	(working copy)
@@ -5,9 +5,9 @@ struct S
   int s;
   S () : s (0) {}
 private:
-  #pragma omp declare reduction (+:S:omp_out.s += omp_in.s)	// { dg-error "is private" }
+  #pragma omp declare reduction (+:S:omp_out.s += omp_in.s)	// { dg-message "private" }
 protected:
-  #pragma omp declare reduction (-:S:omp_out.s += omp_in.s)	// { dg-error "is protected" }
+  #pragma omp declare reduction (-:S:omp_out.s += omp_in.s)	// { dg-message "protected" }
 };
 
 struct T : public S
Index: testsuite/g++.dg/inherit/access6.C
===================================================================
--- testsuite/g++.dg/inherit/access6.C	(revision 221871)
+++ testsuite/g++.dg/inherit/access6.C	(working copy)
@@ -1,9 +1,9 @@
 // PR c++/28588
 
 class Foo { 
-  static void f(); // { dg-error "private" }
+  static void f(); // { dg-message "private" }
   static void f(int);
-  static void g(); // { dg-error "private" }
+  static void g(); // { dg-message "private" }
 };
 
 void h()
Index: testsuite/g++.dg/lookup/duperr1.C
===================================================================
--- testsuite/g++.dg/lookup/duperr1.C	(revision 221871)
+++ testsuite/g++.dg/lookup/duperr1.C	(working copy)
@@ -1,5 +1,5 @@
 // PR c++/29048
 
 class A { int i; }; // { dg-bogus "is private.*is private" }
-// { dg-error "is private" "" { target *-*-* } 3 }
+// { dg-message "private" "" { target *-*-* } 3 }
 class B:public A { B() { A::i=0; } }; // { dg-error "within this context" }
Index: testsuite/g++.dg/lookup/friend2.C
===================================================================
--- testsuite/g++.dg/lookup/friend2.C	(revision 221871)
+++ testsuite/g++.dg/lookup/friend2.C	(working copy)
@@ -12,7 +12,7 @@ struct S {
 namespace NS {
   class X {
       friend class S;
-      static int *i;	// { dg-error "private" }
+      static int *i;	// { dg-message "private" }
   };
 }
 
Index: testsuite/g++.dg/lookup/pr6936.C
===================================================================
--- testsuite/g++.dg/lookup/pr6936.C	(revision 221871)
+++ testsuite/g++.dg/lookup/pr6936.C	(working copy)
@@ -3,7 +3,7 @@
 
 struct Baser
 {
-    enum { j, i }; // { dg-error "inaccessible" }
+    enum { j, i }; // { dg-message "declared" }
 };
 
 struct Base : Baser
Index: testsuite/g++.dg/lookup/scoped1.C
===================================================================
--- testsuite/g++.dg/lookup/scoped1.C	(revision 221871)
+++ testsuite/g++.dg/lookup/scoped1.C	(working copy)
@@ -4,7 +4,7 @@
 struct A
 {
   static int i1;
-  int i2; // { dg-error "inaccessible" "" }
+  int i2; // { dg-message "declared" "" }
   static void f1 ();
   void f2 ();
 };
Index: testsuite/g++.dg/lookup/using26.C
===================================================================
--- testsuite/g++.dg/lookup/using26.C	(revision 221871)
+++ testsuite/g++.dg/lookup/using26.C	(working copy)
@@ -9,7 +9,7 @@ struct A
 struct B
 {
 private:
-    int next; // { dg-error "private" }
+    int next; // { dg-message "private" }
 };
 
 struct C
Index: testsuite/g++.dg/lookup/using38.C
===================================================================
--- testsuite/g++.dg/lookup/using38.C	(revision 221871)
+++ testsuite/g++.dg/lookup/using38.C	(working copy)
@@ -3,7 +3,7 @@
 
 struct Baser
 {
-    enum { j, i }; // { dg-error "inaccessible" }
+    enum { j, i }; // { dg-message "declared" }
 };
 
 struct Base : Baser
Index: testsuite/g++.dg/other/access2.C
===================================================================
--- testsuite/g++.dg/other/access2.C	(revision 221871)
+++ testsuite/g++.dg/other/access2.C	(working copy)
@@ -18,7 +18,7 @@ class Derived : public Base {
   void test();
 };
 
-int Base::fooprivate=42;	// { dg-error "private" }
+int Base::fooprivate=42;	// { dg-message "private" }
 int Base::fooprotected=42;
 int Base::foopublic=42;
 
Index: testsuite/g++.dg/overload/defarg3.C
===================================================================
--- testsuite/g++.dg/overload/defarg3.C	(revision 221871)
+++ testsuite/g++.dg/overload/defarg3.C	(working copy)
@@ -3,7 +3,7 @@
 
 class C {
 private:
-  static int f(int); // { dg-error "private" }
+  static int f(int); // { dg-message "private" }
   static int f(char);
 };
 
Index: testsuite/g++.dg/overload/defarg6.C
===================================================================
--- testsuite/g++.dg/overload/defarg6.C	(revision 221871)
+++ testsuite/g++.dg/overload/defarg6.C	(working copy)
@@ -1,7 +1,7 @@
 class A
 {
   int i;
-  A(int i): i(i) {}		// { dg-error "private" }
+  A(int i): i(i) {}		// { dg-message "private" }
 };
 
 void f (A = 1) { }		// { dg-error "context" }
Index: testsuite/g++.dg/parse/access11.C
===================================================================
--- testsuite/g++.dg/parse/access11.C	(revision 221871)
+++ testsuite/g++.dg/parse/access11.C	(working copy)
@@ -2,24 +2,24 @@
 
 class A {
   union {
-    int i;       // { dg-error "private" }
+    int i;       // { dg-message "private" }
   };
   union {
-    int j;       // { dg-error "private" }
+    int j;       // { dg-message "private" }
   }; 
   union {
     union {
-      int k;     // { dg-error "private" }
+      int k;     // { dg-message "private" }
     };
     union {
       union {
-	int l;   // { dg-error "private" }
+	int l;   // { dg-message "private" }
       };
       union {
-	int m;   // { dg-error "private" }
+	int m;   // { dg-message "private" }
 	union {
-	  int n; // { dg-error "private" }
-	  int o; // { dg-error "private" }
+	  int n; // { dg-message "private" }
+	  int o; // { dg-message "private" }
 	};
       };
     };
Index: testsuite/g++.dg/parse/access2.C
===================================================================
--- testsuite/g++.dg/parse/access2.C	(revision 221871)
+++ testsuite/g++.dg/parse/access2.C	(working copy)
@@ -5,7 +5,7 @@
 // Deferred access checking of variable declaration.
 
 class A {
-  typedef int X;	// { dg-error "private" }
+  typedef int X;	// { dg-message "private" }
   static X a, b, c;
 };
 
Index: testsuite/g++.dg/parse/access3.C
===================================================================
--- testsuite/g++.dg/parse/access3.C	(revision 221871)
+++ testsuite/g++.dg/parse/access3.C	(working copy)
@@ -6,7 +6,7 @@
 
 class A {
 private:
-  void f();		// { dg-error "private" }
+  void f();		// { dg-message "private" }
 };
 
 class B {
Index: testsuite/g++.dg/parse/access4.C
===================================================================
--- testsuite/g++.dg/parse/access4.C	(revision 221871)
+++ testsuite/g++.dg/parse/access4.C	(working copy)
@@ -6,7 +6,7 @@
 
 class A {
 protected:
-  void foo() {}			// { dg-error "protected" }
+  void foo() {}			// { dg-message "protected" }
 public:
   A();
 };
Index: testsuite/g++.dg/parse/access5.C
===================================================================
--- testsuite/g++.dg/parse/access5.C	(revision 221871)
+++ testsuite/g++.dg/parse/access5.C	(working copy)
@@ -7,7 +7,7 @@
 struct A 
 {
 protected:
-  int a;			// { dg-error "protected" }
+  int a;			// { dg-message "protected" }
 };
 
 struct B : A 
Index: testsuite/g++.dg/parse/access6.C
===================================================================
--- testsuite/g++.dg/parse/access6.C	(revision 221871)
+++ testsuite/g++.dg/parse/access6.C	(working copy)
@@ -8,7 +8,7 @@
 class A
 {
   public:
-    int foo() { return 1; }	// { dg-error "inaccessible" }
+    int foo() { return 1; }	// { dg-message "declared" }
 };
 
 class B : public A
Index: testsuite/g++.dg/parse/access8.C
===================================================================
--- testsuite/g++.dg/parse/access8.C	(revision 221871)
+++ testsuite/g++.dg/parse/access8.C	(working copy)
@@ -2,7 +2,7 @@
 
 class foo
 {
-  typedef int memfun;  // { dg-error "private" }
+  typedef int memfun;  // { dg-message "private" }
 };
 
 template<foo::memfun> // { dg-error "context" }
Index: testsuite/g++.dg/parse/access9.C
===================================================================
--- testsuite/g++.dg/parse/access9.C	(revision 221871)
+++ testsuite/g++.dg/parse/access9.C	(working copy)
@@ -1,5 +1,5 @@
 // PR c++/24782
 
 class Foo { public:  typedef int type1; };
-class Bar { private: typedef Foo type2; }; // { dg-error "private" } 
+class Bar { private: typedef Foo type2; }; // { dg-message "private" } 
 void g(Bar::type2::type1) {} // { dg-error "context" }
Index: testsuite/g++.dg/parse/crash40.C
===================================================================
--- testsuite/g++.dg/parse/crash40.C	(revision 221871)
+++ testsuite/g++.dg/parse/crash40.C	(working copy)
@@ -10,7 +10,7 @@ struct C : A {};
 
 class AA
 {
-  template<int> void foo(); /* { dg-error "is private" } */
+  template<int> void foo(); /* { dg-message "private" } */
 };
 struct BB : AA {};
 
@@ -20,7 +20,7 @@ class AAA {
 struct BBB {
   static BBB *foo();
 private:
-  int get() const {} /* { dg-error "is private" } */
+  int get() const {} /* { dg-message "private" } */
 };
 template<bool> struct S {
   S(unsigned int = BBB::foo()->AAA::get()); /* { dg-error "is not a base of" } */
Index: testsuite/g++.dg/tc1/dr142.C
===================================================================
--- testsuite/g++.dg/tc1/dr142.C	(revision 221871)
+++ testsuite/g++.dg/tc1/dr142.C	(working copy)
@@ -2,10 +2,10 @@
 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
 // DR142: Injection-related errors in access example 
 
-class B {                 // { dg-error "inaccessible" }
+class B {                 // { dg-message "declared" }
 public:
-  int mi;                 // { dg-error "inaccessible" }
-  static int si;          // { dg-error "inaccessible" }
+  int mi;                 // { dg-message "declared" }
+  static int si;          // { dg-message "declared" }
 };
 
 class D: private B {
Index: testsuite/g++.dg/tc1/dr166.C
===================================================================
--- testsuite/g++.dg/tc1/dr166.C	(revision 221871)
+++ testsuite/g++.dg/tc1/dr166.C	(working copy)
@@ -9,17 +9,17 @@ namespace N {
   namespace M {
     class A {
       friend void f<int>(int); // N::f
-      static int x;   // { dg-error "private" }
+      static int x;   // { dg-message "private" }
     };
     
     class B {
       template <class T> friend void f(T);  // M::f
-      static int x;   // { dg-error "private" }
+      static int x;   // { dg-message "private" }
     };
 
     class C {
       friend void g(); // M::g
-      static int x;   // { dg-error "private" }
+      static int x;   // { dg-message "private" }
     };
 
     template <class T> void f(T)  // will be instantiated as f<long>
Index: testsuite/g++.dg/tc1/dr52.C
===================================================================
--- testsuite/g++.dg/tc1/dr52.C	(revision 221871)
+++ testsuite/g++.dg/tc1/dr52.C	(working copy)
@@ -17,7 +17,7 @@ struct B1 : B {};
 struct B2 : B {};
 
 struct C
-{ // { dg-error "C" }
+{ // { dg-message "declared" }
   void foo(void);
 };
 
Index: testsuite/g++.dg/template/access11.C
===================================================================
--- testsuite/g++.dg/template/access11.C	(revision 221871)
+++ testsuite/g++.dg/template/access11.C	(working copy)
@@ -5,7 +5,7 @@
 // Access checking during explicit instantiation.
 
 class A {
-  typedef int X;		// { dg-error "private" }
+  typedef int X;		// { dg-message "private" }
 };
 
 class X {
Index: testsuite/g++.dg/template/access18.C
===================================================================
--- testsuite/g++.dg/template/access18.C	(revision 221871)
+++ testsuite/g++.dg/template/access18.C	(working copy)
@@ -1,10 +1,10 @@
 // DR 401
 
 class X {
-  typedef int a; // { dg-error "private" }
-  static const int b = 5; // { dg-error "private" }
+  typedef int a; // { dg-message "private" }
+  static const int b = 5; // { dg-message "private" }
   template <typename>
-  struct c; // { dg-error "private" }
+  struct c; // { dg-message "private" }
 };
 
 template <typename = X::a> // { dg-error "context" }
Index: testsuite/g++.dg/template/access19.C
===================================================================
--- testsuite/g++.dg/template/access19.C	(revision 221871)
+++ testsuite/g++.dg/template/access19.C	(working copy)
@@ -9,7 +9,7 @@ class explicit_t
         operator T&() { return value; }
 private:
         template< class U >
-        explicit_t( U t ); /* { dg-error "with U = char, T = int|is private" } */
+        explicit_t( U t ); /* { dg-message "with U = char, T = int|private" } */
         T value;
 };
 
Index: testsuite/g++.dg/template/access2.C
===================================================================
--- testsuite/g++.dg/template/access2.C	(revision 221871)
+++ testsuite/g++.dg/template/access2.C	(working copy)
@@ -9,8 +9,8 @@ template <class T> struct A {
 };
 
 class B {
-  typedef int X;			// { dg-error "private" }
-  static int i;				// { dg-error "private" }
+  typedef int X;			// { dg-message "private" }
+  static int i;				// { dg-message "private" }
 };
 
 int main()
Index: testsuite/g++.dg/template/access20.C
===================================================================
--- testsuite/g++.dg/template/access20.C	(revision 221871)
+++ testsuite/g++.dg/template/access20.C	(working copy)
@@ -3,7 +3,7 @@
 template <typename T> struct B
 {
         protected:
-        T v;			// { dg-error "protected" }
+        T v;			// { dg-message "protected" }
 };
 template <typename T> struct D : B<T>
 {
Index: testsuite/g++.dg/template/access26.C
===================================================================
--- testsuite/g++.dg/template/access26.C	(revision 221871)
+++ testsuite/g++.dg/template/access26.C	(working copy)
@@ -2,5 +2,5 @@
 
 template < typename T >
 struct A { static int i; };
-class B { typedef int X; };	// { dg-error "private" }
+class B { typedef int X; };	// { dg-message "private" }
 void f() { A<B::X>::i = 0; }	// { dg-error "this context" }
Index: testsuite/g++.dg/template/access3.C
===================================================================
--- testsuite/g++.dg/template/access3.C	(revision 221871)
+++ testsuite/g++.dg/template/access3.C	(working copy)
@@ -8,7 +8,7 @@ template <class T> struct A {
 };
 
 class B {
-  template <class T> class X {};	// { dg-error "private" }
+  template <class T> class X {};	// { dg-message "private" }
 };
 
 int main()
Index: testsuite/g++.dg/template/access7.C
===================================================================
--- testsuite/g++.dg/template/access7.C	(revision 221871)
+++ testsuite/g++.dg/template/access7.C	(working copy)
@@ -5,7 +5,7 @@
 
 template <typename A>
 class S {
-  class T {};				// { dg-error "private" }
+  class T {};				// { dg-message "private" }
 };
 
 template <typename A>
Index: testsuite/g++.dg/template/conv12.C
===================================================================
--- testsuite/g++.dg/template/conv12.C	(revision 221871)
+++ testsuite/g++.dg/template/conv12.C	(working copy)
@@ -16,7 +16,7 @@ struct C2
 {
 private:
   template <class T>
-  operator T();			// { dg-error "private" }
+  operator T();			// { dg-message "private" }
 public:
   operator bool() { return false; }
 } c2;
Index: testsuite/g++.dg/template/crash69.C
===================================================================
--- testsuite/g++.dg/template/crash69.C	(revision 221871)
+++ testsuite/g++.dg/template/crash69.C	(working copy)
@@ -2,7 +2,7 @@
 
 template<typename T> class A
 {
-  static int i; // { dg-error "is private" }
+  static int i; // { dg-message "private" }
   friend int T::foo(); // { dg-error "does not match" }
 };
 
Index: testsuite/g++.dg/template/friend31.C
===================================================================
--- testsuite/g++.dg/template/friend31.C	(revision 221871)
+++ testsuite/g++.dg/template/friend31.C	(working copy)
@@ -10,7 +10,7 @@ template <typename T, typename U> struct F; // { d
 class W
 {
   template<int i> friend class F;	// { dg-error "template parameter" }
-  int x;                                // { dg-error "private" }
+  int x;                                // { dg-message "private" }
 };
 
 template <typename T, typename U> struct F
Index: testsuite/g++.dg/template/friend32.C
===================================================================
--- testsuite/g++.dg/template/friend32.C	(revision 221871)
+++ testsuite/g++.dg/template/friend32.C	(working copy)
@@ -7,7 +7,7 @@
 
 template<class T> class A
 {
-  void f ();			// { dg-error "private" }
+  void f ();			// { dg-message "private" }
 };
 
 template<class T> class B
Index: testsuite/g++.dg/template/memfriend15.C
===================================================================
--- testsuite/g++.dg/template/memfriend15.C	(revision 221871)
+++ testsuite/g++.dg/template/memfriend15.C	(working copy)
@@ -17,7 +17,7 @@ template<class T> struct A
 };
 
 class C {
-  int i;	// { dg-error "private" }
+  int i;	// { dg-message "private" }
   template<class T> friend struct A<T>::B1;
 };
 
Index: testsuite/g++.dg/template/memfriend16.C
===================================================================
--- testsuite/g++.dg/template/memfriend16.C	(revision 221871)
+++ testsuite/g++.dg/template/memfriend16.C	(working copy)
@@ -17,7 +17,7 @@ template<class T> struct A
 };
 
 class C {
-  int i;	// { dg-error "private" }
+  int i;	// { dg-message "private" }
   template<class T> template <class U> friend struct A<T>::B1;
 };
 
Index: testsuite/g++.dg/template/memfriend17.C
===================================================================
--- testsuite/g++.dg/template/memfriend17.C	(revision 221871)
+++ testsuite/g++.dg/template/memfriend17.C	(working copy)
@@ -18,7 +18,7 @@ template<typename Q>
 class F1
 {
     friend class A<Q>::B;
-    enum { foo = 0 };	// { dg-error "private" }
+    enum { foo = 0 };	// { dg-message "private" }
 };
 
 template<typename Q>
Index: testsuite/g++.dg/template/memfriend7.C
===================================================================
--- testsuite/g++.dg/template/memfriend7.C	(revision 221871)
+++ testsuite/g++.dg/template/memfriend7.C	(working copy)
@@ -15,7 +15,7 @@ template <class T> struct A {
 };
 
 class C {
-  int ii;				// { dg-error "private" }
+  int ii;				// { dg-message "private" }
   template <class U> template <class V>
     friend void A<U>::f(V);
   template <class U> friend void A<U>::g();
Index: testsuite/g++.dg/template/pr32519.C
===================================================================
--- testsuite/g++.dg/template/pr32519.C	(revision 221871)
+++ testsuite/g++.dg/template/pr32519.C	(working copy)
@@ -4,7 +4,7 @@
 struct B
 {
 protected:
-  template <class T> void f (); // { dg-error "protected" }
+  template <class T> void f (); // { dg-message "protected" }
 };
 
 struct D : public B
Index: testsuite/g++.dg/template/qualttp21.C
===================================================================
--- testsuite/g++.dg/template/qualttp21.C	(revision 221871)
+++ testsuite/g++.dg/template/qualttp21.C	(working copy)
@@ -8,7 +8,7 @@ class foo {
 public:
    foo() {}
 protected:
-   ~foo() {} // { dg-error "~foo" }
+   ~foo() {} // { dg-message "protected" }
 };
 
 int main()
Index: testsuite/g++.dg/template/qualttp8.C
===================================================================
--- testsuite/g++.dg/template/qualttp8.C	(revision 221871)
+++ testsuite/g++.dg/template/qualttp8.C	(working copy)
@@ -11,7 +11,7 @@ template <class T> struct D {
 
 struct E {
 	private:
-	template <class T> class B {}; // { dg-error "private" }
+	template <class T> class B {}; // { dg-message "private" }
 };
 
 D<E> d; // { dg-message "required" }
Index: testsuite/g++.dg/template/ttp10.C
===================================================================
--- testsuite/g++.dg/template/ttp10.C	(revision 221871)
+++ testsuite/g++.dg/template/ttp10.C	(working copy)
@@ -9,8 +9,8 @@ template <typename> struct Template {};
  
 template<template<typename> class D> 
 struct B { 
-    static void foo1(const D<void> *);	// { dg-error "const" }
-    static void foo2(volatile D<void> *);// { dg-error "volatile" }
+    static void foo1(const D<void> *);	// { dg-message "declared" }
+    static void foo2(volatile D<void> *);// { dg-message "declared" }
 }; 
  
 class E : protected B<Template> {}; 
Index: testsuite/g++.dg/template/typedef11.C
===================================================================
--- testsuite/g++.dg/template/typedef11.C	(revision 221871)
+++ testsuite/g++.dg/template/typedef11.C	(working copy)
@@ -5,13 +5,13 @@
 
 class Alpha
 {
-  typedef int X; // { dg-error "'typedef int Alpha::X' is private" }
+  typedef int X; // { dg-message "private" }
 };
 
 template<int>
 class Beta
 {
-    typedef int Y; // { dg-error "'typedef int Beta<0>::Y' is private" }
+    typedef int Y; // { dg-message "private" }
 };
 
 template <int>
Index: testsuite/g++.dg/template/typedef13.C
===================================================================
--- testsuite/g++.dg/template/typedef13.C	(revision 221871)
+++ testsuite/g++.dg/template/typedef13.C	(working copy)
@@ -4,7 +4,7 @@
 
 class A
 {
-  typedef int mytype; // { dg-error "typedef int A::mytype' is private" }
+  typedef int mytype; // { dg-message "private" }
 };
 
 template <class T> class B : public A
Index: testsuite/g++.dg/template/typedef19.C
===================================================================
--- testsuite/g++.dg/template/typedef19.C	(revision 221871)
+++ testsuite/g++.dg/template/typedef19.C	(working copy)
@@ -4,7 +4,7 @@
 
 class A
 {
-  typedef int mytype; // { dg-error "'typedef int A::mytype' is private" }
+  typedef int mytype; // { dg-message "private" }
 };
 
 template <class T>
Index: testsuite/g++.dg/template/typedef20.C
===================================================================
--- testsuite/g++.dg/template/typedef20.C	(revision 221871)
+++ testsuite/g++.dg/template/typedef20.C	(working copy)
@@ -4,7 +4,7 @@
 
 class x
 {
-  typedef int privtype; // { dg-error "is private" }
+  typedef int privtype; // { dg-message "private" }
 
 protected:
   typedef int type;
Index: testsuite/g++.dg/template/typedef22.C
===================================================================
--- testsuite/g++.dg/template/typedef22.C	(revision 221871)
+++ testsuite/g++.dg/template/typedef22.C	(working copy)
@@ -6,7 +6,7 @@ template <typename T>
 struct B
 {
 protected:
-  typedef int M; // { dg-error "protected" }
+  typedef int M; // { dg-message "protected" }
 };
 
 template <typename T>
Index: testsuite/g++.dg/template/using16.C
===================================================================
--- testsuite/g++.dg/template/using16.C	(revision 221871)
+++ testsuite/g++.dg/template/using16.C	(working copy)
@@ -11,7 +11,7 @@ struct B
 {
     class type
     {
-	type(); // { dg-error "private" }
+	type(); // { dg-message "private" }
     };
 };
 
Index: testsuite/g++.dg/template/virtual3.C
===================================================================
--- testsuite/g++.dg/template/virtual3.C	(revision 221871)
+++ testsuite/g++.dg/template/virtual3.C	(working copy)
@@ -2,7 +2,7 @@
 
 template<int> class A
 {
-  virtual ~A();			// { dg-error "non-deleted|private" }
+  virtual ~A();			// { dg-message "non-deleted|private" }
 };
 
 struct B : A<0>, A<1>		// { dg-error "deleted|context" }
Index: testsuite/g++.dg/ubsan/pr61272.C
===================================================================
--- testsuite/g++.dg/ubsan/pr61272.C	(revision 221871)
+++ testsuite/g++.dg/ubsan/pr61272.C	(working copy)
@@ -7,7 +7,7 @@ namespace std
   template < typename _Tp > class allocator;
   template < typename _Alloc > struct allocator_traits {
   private:
-      template < typename _Tp > auto construct ( _Alloc & __a, _Tp * __p)-> // { dg-error "is private" }
+      template < typename _Tp > auto construct ( _Alloc & __a, _Tp * __p)-> // { dg-message "private" }
       decltype (_S_construct (__a, __p)) { }
   };
   namespace __gnu_cxx
Index: testsuite/g++.old-deja/g++.bob/inherit2.C
===================================================================
--- testsuite/g++.old-deja/g++.bob/inherit2.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.bob/inherit2.C	(working copy)
@@ -6,7 +6,7 @@ class A {
   void z();
   A(void) {}
 private:
-  A(const A &) { abort(); } // { dg-error "private" } 
+  A(const A &) { abort(); } // { dg-message "private" } 
   const A& operator =(const A &) { abort(); }
 };
 
Index: testsuite/g++.old-deja/g++.brendan/crash11.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/crash11.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/crash11.C	(working copy)
@@ -3,8 +3,8 @@
 extern "C" int printf (const char *, ...);
 
 class A {
-        int	i; // { dg-error "" } private
-        int	j; // { dg-error "" } private
+        int	i; // { dg-message "" } private
+        int	j; // { dg-message "" } private
     public:
 	int	h;
 	A() { i=10; j=20; }
Index: testsuite/g++.old-deja/g++.brendan/enum6.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/enum6.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/enum6.C	(working copy)
@@ -2,7 +2,7 @@
 // GROUPS passed enums
 class X {
   private:
-    enum E1 {a1, b1}; // { dg-error "" } private
+    enum E1 {a1, b1}; // { dg-message "" } private
   public:
     enum E2 {a2, b2};
     };
Index: testsuite/g++.old-deja/g++.brendan/visibility1.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility1.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/visibility1.C	(working copy)
@@ -2,7 +2,7 @@
 // GROUPS passed visibility
 class foo {
 protected:
-  int i; // { dg-error "" } protected
+  int i; // { dg-message "" } protected
 };
 
 class bar : public foo {
Index: testsuite/g++.old-deja/g++.brendan/visibility10.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility10.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/visibility10.C	(working copy)
@@ -3,7 +3,7 @@
 struct base
 {
     protected:
-        void base_func() {}// { dg-error "" } .*is protected.*
+        void base_func() {}// { dg-message "" } .*protected.*
 };
 
 struct derived : public base
Index: testsuite/g++.old-deja/g++.brendan/visibility2.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility2.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/visibility2.C	(working copy)
@@ -1,7 +1,7 @@
 // { dg-do assemble  }
 // GROUPS passed visibility
 class X {
-      void g (int); // { dg-error "" } private
+      void g (int); // { dg-message "" } private
 public:
   void g (double);
 };
Index: testsuite/g++.old-deja/g++.brendan/visibility6.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility6.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/visibility6.C	(working copy)
@@ -3,7 +3,7 @@
 class bottom
 {
 public:
-  int b; // { dg-error "" } private
+  int b; // { dg-message "" } private
 };
 class middle : private bottom
 {
Index: testsuite/g++.old-deja/g++.brendan/visibility7.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility7.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/visibility7.C	(working copy)
@@ -3,7 +3,7 @@
 class X
 {
 public:
-  void fn ();// { dg-error "" } .*
+  void fn ();// { dg-message "" } .*
 };
 class Y : private X
 {};
Index: testsuite/g++.old-deja/g++.brendan/visibility8.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility8.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/visibility8.C	(working copy)
@@ -5,7 +5,7 @@
 class foo
 {
 public:
-  static int y; // { dg-error "" } private
+  static int y; // { dg-message "" } private
 };
 class foo1 : private foo
 { };
Index: testsuite/g++.old-deja/g++.brendan/visibility9.C
===================================================================
--- testsuite/g++.old-deja/g++.brendan/visibility9.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.brendan/visibility9.C	(working copy)
@@ -2,7 +2,7 @@
 // GROUPS passed visibility
 class A {
 public:
-        void aMethod(void) {};// { dg-error "" } .*
+        void aMethod(void) {};// { dg-message "" } .*
 };
 
 class AA : A { };
Index: testsuite/g++.old-deja/g++.bugs/900428_03.C
===================================================================
--- testsuite/g++.old-deja/g++.bugs/900428_03.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.bugs/900428_03.C	(working copy)
@@ -18,7 +18,7 @@ struct struct_0 {
 };
 
 struct_0::struct_0 (int i) { }
-struct_0::struct_0 (int, int) { } // { dg-error "is private" }
+struct_0::struct_0 (int, int) { } // { dg-message "private" }
 
 struct struct_1 : public struct_0 {
 
Index: testsuite/g++.old-deja/g++.jason/access17.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access17.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.jason/access17.C	(working copy)
@@ -3,8 +3,8 @@
 
 struct A {
 protected:
-  int i;                        // { dg-error "" } private
-  int f ();			// { dg-error "" } 
+  int i;                        // { dg-message "" } private
+  int f ();			// { dg-message "" } 
 };
 
 struct B: public A {
Index: testsuite/g++.old-deja/g++.jason/access18.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access18.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.jason/access18.C	(working copy)
@@ -6,8 +6,8 @@
 int r = 0;
 class A {
   private:
-    A() { r = 1; }		// { dg-error "" } 
-    ~A() {}			// { dg-error "" } 
+    A() { r = 1; }		// { dg-message "" } 
+    ~A() {}			// { dg-message "" } 
 };
     
 class B : public A {
Index: testsuite/g++.old-deja/g++.jason/access22.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access22.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.jason/access22.C	(working copy)
@@ -5,7 +5,7 @@
 class A
 {
   private:
-    static void foo() {}	// { dg-error "" } 
+    static void foo() {}	// { dg-message "" } 
   public:
     void goo() {}
 };
Index: testsuite/g++.old-deja/g++.jason/access23.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access23.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.jason/access23.C	(working copy)
@@ -17,24 +17,24 @@ struct Foo {
   int PUB_A;
 protected:
   union {
-    long B; // { dg-error "" } protected
-    void *pY; // { dg-error "" } protected
+    long B; // { dg-message "" } protected
+    void *pY; // { dg-message "" } protected
   } ;
   union Y {
     long B;
     void *pY;
-  } PRT; // { dg-error "" } protected
-  int PRT_A; // { dg-error "" } protected
+  } PRT; // { dg-message "" } protected
+  int PRT_A; // { dg-message "" } protected
 private:
   union {
-    long C; // { dg-error "" } private
-    void *pZ; // { dg-error "" } private
+    long C; // { dg-message "" } private
+    void *pZ; // { dg-message "" } private
   };
   union Z {
     long C;  
     void *pZ;
-  } PRV; // { dg-error "" } private
-  int PRV_A; // { dg-error "" } private
+  } PRV; // { dg-message "" } private
+  int PRV_A; // { dg-message "" } private
 };
 
 struct Bar : public Foo {
Index: testsuite/g++.old-deja/g++.jason/access8.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/access8.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.jason/access8.C	(working copy)
@@ -3,7 +3,7 @@
 // Date: 25 Jan 1994 23:41:33 -0500
 // Bug: g++ forgets access decls after the definition.
 
-class inh { // { dg-error "" } inaccessible
+class inh { // { dg-message "" } inaccessible
         int a;
 protected:
         void myf(int);
Index: testsuite/g++.old-deja/g++.jason/delete3.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/delete3.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.jason/delete3.C	(working copy)
@@ -6,7 +6,7 @@ class A {
   A();
   ~A();
 protected:
-  void operator delete(void *);	// { dg-error "" } protected
+  void operator delete(void *);	// { dg-message "" } protected
 };
 
 A::~A()
Index: testsuite/g++.old-deja/g++.jason/report.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/report.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.jason/report.C	(working copy)
@@ -42,7 +42,7 @@ int foo2 (int (*a)(int) = &foo)
 }
 
 class X{
-  class Y{};			// { dg-error "" } private
+  class Y{};			// { dg-message "" } private
 };
 
 typedef int const * bart ();
Index: testsuite/g++.old-deja/g++.law/access2.C
===================================================================
--- testsuite/g++.old-deja/g++.law/access2.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/access2.C	(working copy)
@@ -10,7 +10,7 @@ template <class T> class Foo
 {
 private:
     friend class Bar; // To avoid warning.
-      Foo(const T &v) {}; // { dg-error "" } private
+      Foo(const T &v) {}; // { dg-message "" } private
 };
 
 
Index: testsuite/g++.old-deja/g++.law/access3.C
===================================================================
--- testsuite/g++.old-deja/g++.law/access3.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/access3.C	(working copy)
@@ -7,7 +7,7 @@
 // Subject: bug with access control to member functions
 
        class X {
-	     void g (int); // { dg-error "" } is private
+	     void g (int); // { dg-message "" } is private
         public:
           void g (double);
         };
Index: testsuite/g++.old-deja/g++.law/access4.C
===================================================================
--- testsuite/g++.old-deja/g++.law/access4.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/access4.C	(working copy)
@@ -6,9 +6,9 @@
 // Subject:  g++ 2.5.5 doesn't warn about inaccessible virtual base ctor
 // Message-ID: <9403030024.AA04534@ses.com>
 
-class ForceLeafSterile { // { dg-error "" } 
+class ForceLeafSterile { // { dg-message "" } 
     friend class Sterile;
-      ForceLeafSterile() {} // { dg-error "" } 
+      ForceLeafSterile() {} // { dg-message "" } 
 };
 
 class Sterile : private virtual ForceLeafSterile {
Index: testsuite/g++.old-deja/g++.law/access5.C
===================================================================
--- testsuite/g++.old-deja/g++.law/access5.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/access5.C	(working copy)
@@ -13,7 +13,7 @@ class enclose {
 protected:
   class nested_protected { int x; };
 private:
-  class nested_private { int x; }; // { dg-error "" } private
+  class nested_private { int x; }; // { dg-message "" } private
 };
 
 class derived : public enclose {
Index: testsuite/g++.old-deja/g++.law/arm12.C
===================================================================
--- testsuite/g++.old-deja/g++.law/arm12.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/arm12.C	(working copy)
@@ -22,7 +22,7 @@ class Y : public X
   Y();
 };
 
-X::X() // { dg-error "is private" }
+X::X() // { dg-message "private" }
 {
   std::cout << "X::X()" << std::endl;
 }
Index: testsuite/g++.old-deja/g++.law/arm14.C
===================================================================
--- testsuite/g++.old-deja/g++.law/arm14.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/arm14.C	(working copy)
@@ -9,7 +9,7 @@
 
 class X {
   private:
-    enum E1 {a1, b1}; // { dg-error "" } private
+    enum E1 {a1, b1}; // { dg-message "" } private
   public:
     enum E2 {a2, b2};
     };
Index: testsuite/g++.old-deja/g++.law/ctors13.C
===================================================================
--- testsuite/g++.old-deja/g++.law/ctors13.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/ctors13.C	(working copy)
@@ -3,7 +3,7 @@
 #include <iostream>
 
 class A {
-   A() {}    // private constructor// { dg-error "" } .*
+   A() {}    // private constructor// { dg-message "" } .*
 };
 
 int main() {
Index: testsuite/g++.old-deja/g++.law/union2.C
===================================================================
--- testsuite/g++.old-deja/g++.law/union2.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/union2.C	(working copy)
@@ -10,9 +10,9 @@ class A {
 public:
   int x;
 private:
-  int y;    // { dg-error "" } private
+  int y;    // { dg-message "" } private
   union {
-    int z;  // { dg-error "" } private
+    int z;  // { dg-message "" } private
   };
 };
 
Index: testsuite/g++.old-deja/g++.law/visibility12.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility12.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility12.C	(working copy)
@@ -6,7 +6,7 @@
 // Subject:  member access rule bug
 // Message-ID: <9306300528.AA17185@coda.mel.dit.CSIRO.AU>
 struct a {
-  int aa; // { dg-error "" } private
+  int aa; // { dg-message "" } private
         };
 
 class b : private a {
Index: testsuite/g++.old-deja/g++.law/visibility15.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility15.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility15.C	(working copy)
@@ -10,7 +10,7 @@
 
 class X {
 private:
-  void* operator new(size_t) throw(){// { dg-error "" } .*
+  void* operator new(size_t) throw(){// { dg-message "" } .*
     printf("Inside private new().\n");
     return NULL;
   }
Index: testsuite/g++.old-deja/g++.law/visibility16.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility16.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility16.C	(working copy)
@@ -7,7 +7,7 @@
 // Message-ID: <9308051553.AA07639@nwd2sun1.analog.com>
 class A {
   protected:
-    int astuff; // { dg-error "" } protected
+    int astuff; // { dg-message "" } protected
     A() {
         astuff = 3; 
     }
Index: testsuite/g++.old-deja/g++.law/visibility17.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility17.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility17.C	(working copy)
@@ -31,12 +31,12 @@ class Derived : public Base
   int num_;
 };
 
-Base::Base() // { dg-error "is private" }
+Base::Base() // { dg-message "private" }
 {
   name_ = std::strcpy(new char[std::strlen(" ") + 1], " ");
 }
 
-Base::Base(char* str) // { dg-error "is private" }
+Base::Base(char* str) // { dg-message "private" }
 {
   if(str != NULL)
     name_ = std::strcpy(new char[std::strlen(str) + 1], str);
Index: testsuite/g++.old-deja/g++.law/visibility18.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility18.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility18.C	(working copy)
@@ -7,7 +7,7 @@
 // Message-ID: <9308061142.AA08533@iiserv>
 struct T1 { int i; };
 
-struct T2 { int j; }; // { dg-error "" } private
+struct T2 { int j; }; // { dg-message "" } private
 
 struct T3 : public T1, private T2 {
 } x;
Index: testsuite/g++.old-deja/g++.law/visibility19.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility19.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility19.C	(working copy)
@@ -7,7 +7,7 @@
 // Message-ID: <9308252030.AA02352@tnt.acsys.com>
 class B {
 protected:
-    int i; // { dg-error "" } protected
+    int i; // { dg-message "" } protected
 };
 
 class D1 : public B {
Index: testsuite/g++.old-deja/g++.law/visibility20.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility20.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility20.C	(working copy)
@@ -8,7 +8,7 @@
 
 class Base {
 protected:
-      void protectedBaseFunction() {} // { dg-error "" } protected
+      void protectedBaseFunction() {} // { dg-message "" } protected
 public:
     Base() {}
 };
Index: testsuite/g++.old-deja/g++.law/visibility21.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility21.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility21.C	(working copy)
@@ -7,7 +7,7 @@
 // Message-ID: <9308121003.AA02294@mi.el.utwente.nl>
 class A {
 protected:
-      void foo(); // { dg-error "" } protected
+      void foo(); // { dg-message "" } protected
 };
 
 class B : public A
Index: testsuite/g++.old-deja/g++.law/visibility24.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility24.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility24.C	(working copy)
@@ -14,7 +14,7 @@ template <class T>
 class A
 {
 public:
-      void Fun() { printf( "Fun fun fun!\n" ); } // { dg-error "" } private
+      void Fun() { printf( "Fun fun fun!\n" ); } // { dg-message "" } private
 };
 
 
Index: testsuite/g++.old-deja/g++.law/visibility4.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility4.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility4.C	(working copy)
@@ -8,7 +8,7 @@
 
 class A {
 public:
-     int b; // { dg-error "" } private
+     int b; // { dg-message "" } private
 };
 
 class C : private A {                   // NOTE WELL. private, not public
Index: testsuite/g++.old-deja/g++.law/visibility5.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility5.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility5.C	(working copy)
@@ -4,7 +4,7 @@
 class a {
 
 private:
-  a (int i);// { dg-error "" } .*
+  a (int i);// { dg-message "" } .*
 
 public:
   a ();
Index: testsuite/g++.old-deja/g++.law/visibility6.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility6.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility6.C	(working copy)
@@ -8,7 +8,7 @@
 class Top {
 public:
     Top() {}
-      void val() {} // { dg-error "" } private base class
+      void val() {} // { dg-message "" } private base class
 };
 
 class Derived : private Top {
Index: testsuite/g++.old-deja/g++.law/visibility7.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility7.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility7.C	(working copy)
@@ -15,9 +15,9 @@ class A {
     {}
   virtual ~A()
     {}
-  virtual void Number(int c) // { dg-error "inaccessible" }
+  virtual void Number(int c) // { dg-message "declared" }
     { number = c; }
-  virtual int Number() // { dg-error "inaccessible" }
+  virtual int Number() // { dg-message "declared" }
     { return number; }
 };
 
Index: testsuite/g++.old-deja/g++.law/visibility8.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility8.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility8.C	(working copy)
@@ -7,7 +7,7 @@
 // Message-ID: <m0nof3E-0021ifC@jts.com
 class t1 {
 protected:
-    int a; // { dg-error "" } protected
+    int a; // { dg-message "" } protected
 };
 
 
Index: testsuite/g++.old-deja/g++.law/visibility9.C
===================================================================
--- testsuite/g++.old-deja/g++.law/visibility9.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.law/visibility9.C	(working copy)
@@ -8,7 +8,7 @@
 
 class A {
 protected:
-    int a; // { dg-error "" } protected
+    int a; // { dg-message "" } protected
 };
 
 class B : public A {
Index: testsuite/g++.old-deja/g++.niklas/t135.C
===================================================================
--- testsuite/g++.old-deja/g++.niklas/t135.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.niklas/t135.C	(working copy)
@@ -8,7 +8,7 @@ template <class T> class C1
 
 class C2
 {
-	int data_member; // { dg-error "" }
+	int data_member; // { dg-message "" }
   friend class C1; // { dg-error "" }
 };
 
Index: testsuite/g++.old-deja/g++.oliva/delete1.C
===================================================================
--- testsuite/g++.old-deja/g++.oliva/delete1.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.oliva/delete1.C	(working copy)
@@ -13,7 +13,7 @@
 struct foo {
   foo() {}
 private:
-  void operator delete(void *) {} // { dg-error "" } private
+  void operator delete(void *) {} // { dg-message "" } private
 } foo_;
 
 struct bar : foo {
Index: testsuite/g++.old-deja/g++.oliva/partord1.C
===================================================================
--- testsuite/g++.old-deja/g++.oliva/partord1.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.oliva/partord1.C	(working copy)
@@ -9,7 +9,7 @@ template <typename T> void foo(T*);
 
 template <typename T> class bar {
  private:
-  int i; // { dg-error "" } this variable
+  int i; // { dg-message "" } this variable
   friend void foo<T>(T);
 };
 
Index: testsuite/g++.old-deja/g++.other/access11.C
===================================================================
--- testsuite/g++.old-deja/g++.other/access11.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/access11.C	(working copy)
@@ -10,7 +10,7 @@ class A
 };
 
 template <>
-void A::g<int>(int t) { i = 1; } // { dg-error "" } private
+void A::g<int>(int t) { i = 1; } // { dg-message "" } private
 
 int main()
 {
Index: testsuite/g++.old-deja/g++.other/access4.C
===================================================================
--- testsuite/g++.old-deja/g++.other/access4.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/access4.C	(working copy)
@@ -1,6 +1,6 @@
 // { dg-do assemble  }
 
-struct A { // { dg-error "" } inaccessible
+struct A { // { dg-message "" } inaccessible
   static int i;
 };
 
Index: testsuite/g++.old-deja/g++.other/access7.C
===================================================================
--- testsuite/g++.old-deja/g++.other/access7.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/access7.C	(working copy)
@@ -4,8 +4,8 @@
 
 
 class A {
-  static int I1;		// { dg-error "" } private
-  struct B1 { };		// { dg-error "" } private
+  static int I1;		// { dg-message "" } private
+  struct B1 { };		// { dg-message "" } private
 public:
   static int I2;
   struct B2 { };
Index: testsuite/g++.old-deja/g++.other/crash1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/crash1.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/crash1.C	(working copy)
@@ -1,7 +1,7 @@
 // { dg-do assemble  }
 class A
 {
-  enum B { ONE, TWO, THREE }; // { dg-error "" } private
+  enum B { ONE, TWO, THREE }; // { dg-message "" } private
 };
 
 class A::B; // { dg-error "" } A::B is not a class type, context
Index: testsuite/g++.old-deja/g++.other/crash7.C
===================================================================
--- testsuite/g++.old-deja/g++.other/crash7.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/crash7.C	(working copy)
@@ -4,7 +4,7 @@ void f()
 {
   union {
   private:
-    int i; // { dg-error "" } private
+    int i; // { dg-message "" } private
   } u;
 
   u.i = 3; // { dg-error "" } within this context
Index: testsuite/g++.old-deja/g++.other/friend1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/friend1.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/friend1.C	(working copy)
@@ -22,7 +22,7 @@ struct R;
 
 class B {
 protected:
-  int i; // { dg-error "" } in this context
+  int i; // { dg-message "" } protected
   static int j;
 };
 
@@ -51,7 +51,7 @@ D d;
 
 void f()
 {
-    b.i = 3; // { dg-error "" } protected
+    b.i = 3; // { dg-error "" } in this context
     d.i = 4;
     B::j = 5;
     D::j = 6;
@@ -60,7 +60,7 @@ void f()
 template <typename T>
 void g()
 {
-    b.i = 3; // { dg-error "" } protected
+    b.i = 3; // { dg-error "" } in this context
     d.i = 4;
     B::j = 5;
     D::j = 6;
@@ -70,7 +70,7 @@ template void g<int>();
 
 void S::h()
 {
-  b.i = 3; // { dg-error "" } protected
+  b.i = 3; // { dg-error "" } in this context
   d.i = 4;
   B::j = 5;
   D::j = 6;
@@ -79,7 +79,7 @@ void S::h()
 template <typename T>
 void R<T>::h() 
 {
-  b.i = 3; // { dg-error "" } protected
+  b.i = 3; // { dg-error "" } in this context
   d.i = 4;
   B::j = 5;
   D::j = 6;
Index: testsuite/g++.old-deja/g++.other/friend4.C
===================================================================
--- testsuite/g++.old-deja/g++.other/friend4.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/friend4.C	(working copy)
@@ -10,7 +10,7 @@
 
 template <class A, class B> void foo();
 template <class C> class bar {
-  int i; // { dg-error "" } private
+  int i; // { dg-message "" } private
   template <class B> friend void foo<C,B>(); // { dg-error "" } bogus declaration
 };
 template <class A, class B> void foo() {
Index: testsuite/g++.old-deja/g++.other/friend9.C
===================================================================
--- testsuite/g++.old-deja/g++.other/friend9.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/friend9.C	(working copy)
@@ -7,7 +7,7 @@
 
 class F
 {
-  class Internal;   // { dg-error "" } is private
+  class Internal;   // { dg-message "" } private
 };
 
 class C
Index: testsuite/g++.old-deja/g++.other/lineno1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/lineno1.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/lineno1.C	(working copy)
@@ -5,8 +5,8 @@
 
 class A
 {
-  A();				// { dg-error "" } private
-  ~A();				// { dg-error "" } private
+  A();				// { dg-message "" } private
+  ~A();				// { dg-message "" } private
 };
 
 static A a;			// { dg-error "" } here
Index: testsuite/g++.old-deja/g++.other/using1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/using1.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.other/using1.C	(working copy)
@@ -3,7 +3,7 @@ class D2;
 
 class B {
 private:
-  int a; // { dg-error "" } B::a is private
+  int a; // { dg-message "" } B::a declared private
 protected:
   int b;
 
Index: testsuite/g++.old-deja/g++.pt/enum14.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/enum14.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.pt/enum14.C	(working copy)
@@ -24,8 +24,8 @@ template <class>
 struct B
 {
   private:
-  enum foo {bar}; // { dg-error "" } private
-  typedef int baz;  // { dg-error "" } private
+  enum foo {bar}; // { dg-message "" } private
+  typedef int baz;  // { dg-message "" } private
 };
 
 struct D: public B<int>
Index: testsuite/g++.old-deja/g++.pt/friend11.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/friend11.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.pt/friend11.C	(working copy)
@@ -21,7 +21,7 @@ class C
   template <class U>
   friend void S<T>::f(U);
 
-  int i; // { dg-error "" } private
+  int i; // { dg-message "" } private
 };
 
 
Index: testsuite/g++.old-deja/g++.pt/friend21.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/friend21.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.pt/friend21.C	(working copy)
@@ -7,7 +7,7 @@ template <class T> struct A {
 template <class T> class B
 {
   friend class A<T>;
-  static int i; // { dg-error "" } private
+  static int i; // { dg-message "" } private
 };
 
 template <class T> class C
Index: testsuite/g++.old-deja/g++.pt/friend3.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/friend3.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.pt/friend3.C	(working copy)
@@ -7,7 +7,7 @@ class C
 {
   friend void f<>(double);
 
-  int i; // { dg-error "" } private
+  int i; // { dg-message "" } private
 };
 
 
Index: testsuite/g++.old-deja/g++.pt/inherit2.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/inherit2.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.pt/inherit2.C	(working copy)
@@ -24,7 +24,7 @@ template <class T> class B
   static T value_AC;
 };
 template <typename T> T B<T>::valueA_AA;
-template <typename T> T B<T>::valueA_AC;// { dg-error "" "" } private - 
+template <typename T> T B<T>::valueA_AC;// { dg-message "" "" } private - 
 template <typename T> T B<T>::value_AC;	// { dg-bogus "" "" }  - 
 
 // this one is a friend
Index: testsuite/g++.old-deja/g++.pt/memtemp74.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/memtemp74.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.pt/memtemp74.C	(working copy)
@@ -5,11 +5,11 @@ class S
 {
 protected:
   template <class U>
-  void f(U); // { dg-error "" } is protected
+  void f(U); // { dg-message "" } protected
 
 private:
   template <class U>
-  void g(U); // { dg-error "" } is private
+  void g(U); // { dg-message "" } private
 };
 
 
Index: testsuite/g++.old-deja/g++.pt/memtemp89.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/memtemp89.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.pt/memtemp89.C	(working copy)
@@ -5,7 +5,7 @@
 
 class Q {
 	template<class T>
-	class X {		// { dg-error "" } Q::X private
+	class X {		// { dg-message "" } Q::X private
 	};
 };
 template<template<class> class XX>
Index: testsuite/g++.old-deja/g++.robertl/eb94.C
===================================================================
--- testsuite/g++.old-deja/g++.robertl/eb94.C	(revision 221871)
+++ testsuite/g++.old-deja/g++.robertl/eb94.C	(working copy)
@@ -10,7 +10,7 @@ static int variable;
 class myClass : public baseClass
 {
 private:
-static int variable;                    // { dg-error "private" }
+static int variable;                    // { dg-message "private" }
 };
 
 myClass::variable = 0;                  //{ dg-error "" } no type

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] Emit error + inform for access control issues
  2015-04-07 15:19     ` Paolo Carlini
@ 2015-04-15  8:48       ` Paolo Carlini
  2015-04-15 13:21       ` Jason Merrill
  1 sibling, 0 replies; 6+ messages in thread
From: Paolo Carlini @ 2015-04-15  8:48 UTC (permalink / raw)
  To: Jason Merrill, gcc-patches

Hi,

On 04/07/2015 05:19 PM, Paolo Carlini wrote:
> ... thus I prepared the below. I tried to minimize the diagnostic 
> changes but a few more testcases needed tweaking anyway.
Is this version Ok for the trunk?

     https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00260.html

Thanks,
Paolo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] Emit error + inform for access control issues
  2015-04-07 15:19     ` Paolo Carlini
  2015-04-15  8:48       ` Paolo Carlini
@ 2015-04-15 13:21       ` Jason Merrill
  1 sibling, 0 replies; 6+ messages in thread
From: Jason Merrill @ 2015-04-15 13:21 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches

Sorry, thought I had responded to this.  OK.

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-15 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-04 13:00 [C++ Patch] Emit error + inform for access control issues Paolo Carlini
2015-04-06 14:07 ` Jason Merrill
2015-04-07  9:35   ` Paolo Carlini
2015-04-07 15:19     ` Paolo Carlini
2015-04-15  8:48       ` Paolo Carlini
2015-04-15 13:21       ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).