+2015-04-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * call.c (enforce_access): Emit error + inform.
+
2015-04-15 Marek Polacek <polacek@redhat.com>
* constexpr.c (use_new_call): Remove #define.
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;
}
+2015-04-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/cpp0x/alias-decl-22.C: Adjust for error + inform change.
+ * g++.dg/cpp0x/decltype-call1.C: Likewise.
+ * g++.dg/cpp0x/defaulted21.C: Likewise.
+ * g++.dg/cpp0x/defaulted28.C: Likewise.
+ * g++.dg/cpp0x/defaulted47.C: Likewise.
+ * g++.dg/cpp0x/elision_neg.C: Likewise.
+ * g++.dg/cpp0x/fntmpdefarg3.C: Likewise.
+ * g++.dg/cpp0x/implicit-trivial1.C: Likewise.
+ * g++.dg/cpp0x/implicit1.C: Likewise.
+ * g++.dg/cpp0x/implicit9.C: Likewise.
+ * g++.dg/cpp0x/inh-ctor9.C: Likewise.
+ * g++.dg/cpp0x/range-for13.C: Likewise.
+ * g++.dg/gomp/clause-2.C: Likewise.
+ * g++.dg/gomp/udr-5.C: Likewise.
+ * g++.dg/inherit/access6.C: Likewise.
+ * g++.dg/lookup/duperr1.C: Likewise.
+ * g++.dg/lookup/friend2.C: Likewise.
+ * g++.dg/lookup/pr6936.C: Likewise.
+ * g++.dg/lookup/scoped1.C: Likewise.
+ * g++.dg/lookup/using26.C: Likewise.
+ * g++.dg/lookup/using38.C: Likewise.
+ * g++.dg/other/access2.C: Likewise.
+ * g++.dg/overload/defarg3.C: Likewise.
+ * g++.dg/overload/defarg6.C: Likewise.
+ * g++.dg/parse/access11.C: Likewise.
+ * g++.dg/parse/access2.C: Likewise.
+ * g++.dg/parse/access3.C: Likewise.
+ * g++.dg/parse/access4.C: Likewise.
+ * g++.dg/parse/access5.C: Likewise.
+ * g++.dg/parse/access6.C: Likewise.
+ * g++.dg/parse/access8.C: Likewise.
+ * g++.dg/parse/access9.C: Likewise.
+ * g++.dg/parse/crash40.C: Likewise.
+ * g++.dg/tc1/dr142.C: Likewise.
+ * g++.dg/tc1/dr166.C: Likewise.
+ * g++.dg/tc1/dr52.C: Likewise.
+ * g++.dg/template/access11.C: Likewise.
+ * g++.dg/template/access18.C: Likewise.
+ * g++.dg/template/access19.C: Likewise.
+ * g++.dg/template/access2.C: Likewise.
+ * g++.dg/template/access20.C: Likewise.
+ * g++.dg/template/access26.C: Likewise.
+ * g++.dg/template/access3.C: Likewise.
+ * g++.dg/template/access7.C: Likewise.
+ * g++.dg/template/conv12.C: Likewise.
+ * g++.dg/template/crash69.C: Likewise.
+ * g++.dg/template/friend31.C: Likewise.
+ * g++.dg/template/friend32.C: Likewise.
+ * g++.dg/template/memfriend15.C: Likewise.
+ * g++.dg/template/memfriend16.C: Likewise.
+ * g++.dg/template/memfriend17.C: Likewise.
+ * g++.dg/template/memfriend7.C: Likewise.
+ * g++.dg/template/pr32519.C: Likewise.
+ * g++.dg/template/qualttp21.C: Likewise.
+ * g++.dg/template/qualttp8.C: Likewise.
+ * g++.dg/template/ttp10.C: Likewise.
+ * g++.dg/template/typedef11.C: Likewise.
+ * g++.dg/template/typedef13.C: Likewise.
+ * g++.dg/template/typedef19.C: Likewise.
+ * g++.dg/template/typedef20.C: Likewise.
+ * g++.dg/template/typedef22.C: Likewise.
+ * g++.dg/template/using16.C: Likewise.
+ * g++.dg/template/virtual3.C: Likewise.
+ * g++.dg/ubsan/pr61272.C: Likewise.
+ * g++.old-deja/g++.bob/inherit2.C: Likewise.
+ * g++.old-deja/g++.brendan/crash11.C: Likewise.
+ * g++.old-deja/g++.brendan/enum6.C: Likewise.
+ * g++.old-deja/g++.brendan/visibility1.C: Likewise.
+ * g++.old-deja/g++.brendan/visibility10.C: Likewise.
+ * g++.old-deja/g++.brendan/visibility2.C: Likewise.
+ * g++.old-deja/g++.brendan/visibility6.C: Likewise.
+ * g++.old-deja/g++.brendan/visibility7.C: Likewise.
+ * g++.old-deja/g++.brendan/visibility8.C: Likewise.
+ * g++.old-deja/g++.brendan/visibility9.C: Likewise.
+ * g++.old-deja/g++.bugs/900428_03.C: Likewise.
+ * g++.old-deja/g++.jason/access17.C: Likewise.
+ * g++.old-deja/g++.jason/access18.C: Likewise.
+ * g++.old-deja/g++.jason/access22.C: Likewise.
+ * g++.old-deja/g++.jason/access23.C: Likewise.
+ * g++.old-deja/g++.jason/access8.C: Likewise.
+ * g++.old-deja/g++.jason/delete3.C: Likewise.
+ * g++.old-deja/g++.jason/report.C: Likewise.
+ * g++.old-deja/g++.law/access2.C: Likewise.
+ * g++.old-deja/g++.law/access3.C: Likewise.
+ * g++.old-deja/g++.law/access4.C: Likewise.
+ * g++.old-deja/g++.law/access5.C: Likewise.
+ * g++.old-deja/g++.law/arm12.C: Likewise.
+ * g++.old-deja/g++.law/arm14.C: Likewise.
+ * g++.old-deja/g++.law/ctors13.C: Likewise.
+ * g++.old-deja/g++.law/union2.C: Likewise.
+ * g++.old-deja/g++.law/visibility12.C: Likewise.
+ * g++.old-deja/g++.law/visibility15.C: Likewise.
+ * g++.old-deja/g++.law/visibility16.C: Likewise.
+ * g++.old-deja/g++.law/visibility17.C: Likewise.
+ * g++.old-deja/g++.law/visibility18.C: Likewise.
+ * g++.old-deja/g++.law/visibility19.C: Likewise.
+ * g++.old-deja/g++.law/visibility20.C: Likewise.
+ * g++.old-deja/g++.law/visibility21.C: Likewise.
+ * g++.old-deja/g++.law/visibility24.C: Likewise.
+ * g++.old-deja/g++.law/visibility4.C: Likewise.
+ * g++.old-deja/g++.law/visibility5.C: Likewise.
+ * g++.old-deja/g++.law/visibility6.C: Likewise.
+ * g++.old-deja/g++.law/visibility7.C: Likewise.
+ * g++.old-deja/g++.law/visibility8.C: Likewise.
+ * g++.old-deja/g++.law/visibility9.C: Likewise.
+ * g++.old-deja/g++.niklas/t135.C: Likewise.
+ * g++.old-deja/g++.oliva/delete1.C: Likewise.
+ * g++.old-deja/g++.oliva/partord1.C: Likewise.
+ * g++.old-deja/g++.other/access11.C: Likewise.
+ * g++.old-deja/g++.other/access4.C: Likewise.
+ * g++.old-deja/g++.other/access7.C: Likewise.
+ * g++.old-deja/g++.other/crash1.C: Likewise.
+ * g++.old-deja/g++.other/crash7.C: Likewise.
+ * g++.old-deja/g++.other/friend1.C: Likewise.
+ * g++.old-deja/g++.other/friend4.C: Likewise.
+ * g++.old-deja/g++.other/friend9.C: Likewise.
+ * g++.old-deja/g++.other/lineno1.C: Likewise.
+ * g++.old-deja/g++.other/using1.C: Likewise.
+ * g++.old-deja/g++.pt/enum14.C: Likewise.
+ * g++.old-deja/g++.pt/friend11.C: Likewise.
+ * g++.old-deja/g++.pt/friend21.C: Likewise.
+ * g++.old-deja/g++.pt/friend3.C: Likewise.
+ * g++.old-deja/g++.pt/inherit2.C: Likewise.
+ * g++.old-deja/g++.pt/memtemp74.C: Likewise.
+ * g++.old-deja/g++.pt/memtemp89.C: Likewise.
+ * g++.old-deja/g++.robertl/eb94.C: Likewise.
+
2015-04-15 Jakub Jelinek <jakub@redhat.com>
PR ipa/65765
class B
{
- typedef int bar; // { dg-error "private" }
+ typedef int bar; // { dg-message "private" }
foo<B> f; // { dg-message "required" }
};
class B
{
- ~B(); // { dg-error "private" }
+ ~B(); // { dg-message "private" }
public:
int i;
void operator[](int);
struct U {
U();
private:
- U(U const&); // { dg-error "private" }
+ U(U const&); // { dg-message "private" }
};
struct X {
A() = default;
private:
- A(A const&) = default; // { dg-error "private" }
+ A(A const&) = default; // { dg-message "private" }
};
int f(...) { }
class A
{
- A() = default; // { dg-error "private" }
+ A() = default; // { dg-message "private" }
};
A a; // { dg-error "context" }
class B
{
- ~B() = default; // { dg-error "private" }
+ ~B() = default; // { dg-message "private" }
};
B b; // { dg-error "context" }
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() {}
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);
{
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" }
class C
{
- void operator delete (void *); // { dg-error "private" }
+ void operator delete (void *); // { dg-message "private" }
public:
virtual ~C(); // { dg-error "overriding" }
};
{
A();
private:
- ~A(); // { dg-error "private" }
+ ~A(); // { dg-message "private" }
};
struct B: A { }; // { dg-error "implicitly deleted|context" }
struct B: A
{
- using A::A; // { dg-error "protected" }
+ using A::A; // { dg-message "protected" }
};
B b(42); // { dg-error "this context" }
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
struct private_callable
{
private:
- int *operator()(); // { dg-error "is private" }
+ int *operator()(); // { dg-message "private" }
};
struct container9
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()
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
// 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()
// 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" }
namespace NS {
class X {
friend class S;
- static int *i; // { dg-error "private" }
+ static int *i; // { dg-message "private" }
};
}
struct Baser
{
- enum { j, i }; // { dg-error "inaccessible" }
+ enum { j, i }; // { dg-message "declared" }
};
struct Base : Baser
struct A
{
static int i1;
- int i2; // { dg-error "inaccessible" "" }
+ int i2; // { dg-message "declared" "" }
static void f1 ();
void f2 ();
};
struct B
{
private:
- int next; // { dg-error "private" }
+ int next; // { dg-message "private" }
};
struct C
struct Baser
{
- enum { j, i }; // { dg-error "inaccessible" }
+ enum { j, i }; // { dg-message "declared" }
};
struct Base : Baser
void test();
};
-int Base::fooprivate=42; // { dg-error "private" }
+int Base::fooprivate=42; // { dg-message "private" }
int Base::fooprotected=42;
int Base::foopublic=42;
class C {
private:
- static int f(int); // { dg-error "private" }
+ static int f(int); // { dg-message "private" }
static int f(char);
};
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" }
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" }
};
};
};
// 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;
};
class A {
private:
- void f(); // { dg-error "private" }
+ void f(); // { dg-message "private" }
};
class B {
class A {
protected:
- void foo() {} // { dg-error "protected" }
+ void foo() {} // { dg-message "protected" }
public:
A();
};
struct A
{
protected:
- int a; // { dg-error "protected" }
+ int a; // { dg-message "protected" }
};
struct B : A
class A
{
public:
- int foo() { return 1; } // { dg-error "inaccessible" }
+ int foo() { return 1; } // { dg-message "declared" }
};
class B : public A
class foo
{
- typedef int memfun; // { dg-error "private" }
+ typedef int memfun; // { dg-message "private" }
};
template<foo::memfun> // { dg-error "context" }
// 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" }
class AA
{
- template<int> void foo(); /* { dg-error "is private" } */
+ template<int> void foo(); /* { dg-message "private" } */
};
struct BB : AA {};
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" } */
// 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 {
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>
struct B2 : B {};
struct C
-{ // { dg-error "C" }
+{ // { dg-message "declared" }
void foo(void);
};
// Access checking during explicit instantiation.
class A {
- typedef int X; // { dg-error "private" }
+ typedef int X; // { dg-message "private" }
};
class X {
// 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" }
operator T&() { return value; }\r
private:\r
template< class U >\r
- explicit_t( U t ); /* { dg-error "with U = char, T = int|is private" } */\r
+ explicit_t( U t ); /* { dg-message "with U = char, T = int|private" } */\r
T value;\r
};\r
\r
};
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()
template <typename T> struct B
{
protected:
- T v; // { dg-error "protected" }
+ T v; // { dg-message "protected" }
};
template <typename T> struct D : B<T>
{
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" }
};
class B {
- template <class T> class X {}; // { dg-error "private" }
+ template <class T> class X {}; // { dg-message "private" }
};
int main()
template <typename A>
class S {
- class T {}; // { dg-error "private" }
+ class T {}; // { dg-message "private" }
};
template <typename A>
{
private:
template <class T>
- operator T(); // { dg-error "private" }
+ operator T(); // { dg-message "private" }
public:
operator bool() { return false; }
} c2;
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" }
};
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
template<class T> class A
{
- void f (); // { dg-error "private" }
+ void f (); // { dg-message "private" }
};
template<class T> class B
};
class C {
- int i; // { dg-error "private" }
+ int i; // { dg-message "private" }
template<class T> friend struct A<T>::B1;
};
};
class C {
- int i; // { dg-error "private" }
+ int i; // { dg-message "private" }
template<class T> template <class U> friend struct A<T>::B1;
};
class F1
{
friend class A<Q>::B;
- enum { foo = 0 }; // { dg-error "private" }
+ enum { foo = 0 }; // { dg-message "private" }
};
template<typename Q>
};
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();
struct B
{
protected:
- template <class T> void f (); // { dg-error "protected" }
+ template <class T> void f (); // { dg-message "protected" }
};
struct D : public B
public:
foo() {}
protected:
- ~foo() {} // { dg-error "~foo" }
+ ~foo() {} // { dg-message "protected" }
};
int main()
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" }
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> {};
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>
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
class A
{
- typedef int mytype; // { dg-error "'typedef int A::mytype' is private" }
+ typedef int mytype; // { dg-message "private" }
};
template <class T>
class x
{
- typedef int privtype; // { dg-error "is private" }
+ typedef int privtype; // { dg-message "private" }
protected:
typedef int type;
struct B
{
protected:
- typedef int M; // { dg-error "protected" }
+ typedef int M; // { dg-message "protected" }
};
template <typename T>
{
class type
{
- type(); // { dg-error "private" }
+ type(); // { dg-message "private" }
};
};
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" }
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
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(); }
};
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; }
// 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};
};
// GROUPS passed visibility
class foo {
protected:
- int i; // { dg-error "" } protected
+ int i; // { dg-message "" } protected
};
class bar : public foo {
struct base
{
protected:
- void base_func() {}// { dg-error "" } .*is protected.*
+ void base_func() {}// { dg-message "" } .*protected.*
};
struct derived : public base
// { dg-do assemble }
// GROUPS passed visibility
class X {
- void g (int); // { dg-error "" } private
+ void g (int); // { dg-message "" } private
public:
void g (double);
};
class bottom
{
public:
- int b; // { dg-error "" } private
+ int b; // { dg-message "" } private
};
class middle : private bottom
{
class X
{
public:
- void fn ();// { dg-error "" } .*
+ void fn ();// { dg-message "" } .*
};
class Y : private X
{};
class foo
{
public:
- static int y; // { dg-error "" } private
+ static int y; // { dg-message "" } private
};
class foo1 : private foo
{ };
// GROUPS passed visibility
class A {
public:
- void aMethod(void) {};// { dg-error "" } .*
+ void aMethod(void) {};// { dg-message "" } .*
};
class AA : A { };
};
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 {
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 {
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 {
class A
{
private:
- static void foo() {} // { dg-error "" }
+ static void foo() {} // { dg-message "" }
public:
void goo() {}
};
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 {
// 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);
A();
~A();
protected:
- void operator delete(void *); // { dg-error "" } protected
+ void operator delete(void *); // { dg-message "" } protected
};
A::~A()
}
class X{
- class Y{}; // { dg-error "" } private
+ class Y{}; // { dg-message "" } private
};
typedef int const * bart ();
{
private:
friend class Bar; // To avoid warning.
- Foo(const T &v) {}; // { dg-error "" } private
+ Foo(const T &v) {}; // { dg-message "" } private
};
// 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);
};
// 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 {
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 {
Y();
};
-X::X() // { dg-error "is private" }
+X::X() // { dg-message "private" }
{
std::cout << "X::X()" << std::endl;
}
class X {
private:
- enum E1 {a1, b1}; // { dg-error "" } private
+ enum E1 {a1, b1}; // { dg-message "" } private
public:
enum E2 {a2, b2};
};
#include <iostream>
class A {
- A() {} // private constructor// { dg-error "" } .*
+ A() {} // private constructor// { dg-message "" } .*
};
int main() {
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
};
};
// 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 {
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;
}
// Message-ID: <9308051553.AA07639@nwd2sun1.analog.com>
class A {
protected:
- int astuff; // { dg-error "" } protected
+ int astuff; // { dg-message "" } protected
A() {
astuff = 3;
}
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);
// 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;
// Message-ID: <9308252030.AA02352@tnt.acsys.com>
class B {
protected:
- int i; // { dg-error "" } protected
+ int i; // { dg-message "" } protected
};
class D1 : public B {
class Base {
protected:
- void protectedBaseFunction() {} // { dg-error "" } protected
+ void protectedBaseFunction() {} // { dg-message "" } protected
public:
Base() {}
};
// 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
class A
{
public:
- void Fun() { printf( "Fun fun fun!\n" ); } // { dg-error "" } private
+ void Fun() { printf( "Fun fun fun!\n" ); } // { dg-message "" } private
};
class A {
public:
- int b; // { dg-error "" } private
+ int b; // { dg-message "" } private
};
class C : private A { // NOTE WELL. private, not public
class a {
private:
- a (int i);// { dg-error "" } .*
+ a (int i);// { dg-message "" } .*
public:
a ();
class Top {
public:
Top() {}
- void val() {} // { dg-error "" } private base class
+ void val() {} // { dg-message "" } private base class
};
class Derived : private Top {
{}
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; }
};
// Message-ID: <m0nof3E-0021ifC@jts.com
class t1 {
protected:
- int a; // { dg-error "" } protected
+ int a; // { dg-message "" } protected
};
class A {
protected:
- int a; // { dg-error "" } protected
+ int a; // { dg-message "" } protected
};
class B : public A {
class C2
{
- int data_member; // { dg-error "" }
+ int data_member; // { dg-message "" }
friend class C1; // { dg-error "" }
};
struct foo {
foo() {}
private:
- void operator delete(void *) {} // { dg-error "" } private
+ void operator delete(void *) {} // { dg-message "" } private
} foo_;
struct bar : foo {
template <typename T> class bar {
private:
- int i; // { dg-error "" } this variable
+ int i; // { dg-message "" } this variable
friend void foo<T>(T);
};
};
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()
{
// { dg-do assemble }
-struct A { // { dg-error "" } inaccessible
+struct A { // { dg-message "" } inaccessible
static int i;
};
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 { };
// { 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
{
union {
private:
- int i; // { dg-error "" } private
+ int i; // { dg-message "" } private
} u;
u.i = 3; // { dg-error "" } within this context
class B {
protected:
- int i; // { dg-error "" } in this context
+ int i; // { dg-message "" } protected
static int j;
};
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;
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;
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;
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;
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() {
class F
{
- class Internal; // { dg-error "" } is private
+ class Internal; // { dg-message "" } private
};
class C
class A
{
- A(); // { dg-error "" } private
- ~A(); // { dg-error "" } private
+ A(); // { dg-message "" } private
+ ~A(); // { dg-message "" } private
};
static A a; // { dg-error "" } here
class B {
private:
- int a; // { dg-error "" } B::a is private
+ int a; // { dg-message "" } B::a declared private
protected:
int b;
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>
template <class U>
friend void S<T>::f(U);
- int i; // { dg-error "" } private
+ int i; // { dg-message "" } private
};
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
{
friend void f<>(double);
- int i; // { dg-error "" } private
+ int i; // { dg-message "" } private
};
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
{
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
};
class Q {
template<class T>
- class X { // { dg-error "" } Q::X private
+ class X { // { dg-message "" } Q::X private
};
};
template<template<class> class XX>
class myClass : public baseClass
{
private:
-static int variable; // { dg-error "private" }
+static int variable; // { dg-message "private" }
};
myClass::variable = 0; //{ dg-error "" } no type