call.c (enforce_access): Emit error + inform.

/cp
2015-04-15  Paolo Carlini  <paolo.carlini@oracle.com>

	* call.c (enforce_access): Emit error + inform.

/testsuite
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.

From-SVN: r222128
This commit is contained in:
Paolo Carlini 2015-04-15 17:18:27 +00:00 committed by Paolo Carlini
parent d26b2237b3
commit 3a1351b9da
129 changed files with 318 additions and 175 deletions

View File

@ -1,3 +1,7 @@
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.

View File

@ -6020,12 +6020,22 @@ enforce_access (tree basetype_path, tree decl, tree diag_decl,
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;
}

View File

@ -1,3 +1,132 @@
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

View File

@ -7,6 +7,6 @@ using foo = typename T::bar; // { dg-error "this context" }
class B
{
typedef int bar; // { dg-error "private" }
typedef int bar; // { dg-message "private" }
foo<B> f; // { dg-message "required" }
};

View File

@ -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);

View File

@ -4,7 +4,7 @@
struct U {
U();
private:
U(U const&); // { dg-error "private" }
U(U const&); // { dg-message "private" }
};
struct X {

View File

@ -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(...) { }

View File

@ -3,14 +3,14 @@
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" }

View File

@ -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() {}

View File

@ -8,7 +8,7 @@ template <class T, class = typename T::I> void j(T) {} // { dg-error "this conte
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);

View File

@ -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" }

View File

@ -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" }
};

View File

@ -5,7 +5,7 @@ struct A
{
A();
private:
~A(); // { dg-error "private" }
~A(); // { dg-message "private" }
};
struct B: A { }; // { dg-error "implicitly deleted|context" }

View File

@ -9,7 +9,7 @@ protected:
struct B: A
{
using A::A; // { dg-error "protected" }
using A::A; // { dg-message "protected" }
};
B b(42); // { dg-error "this context" }

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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" }

View File

@ -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" }
};
}

View File

@ -3,7 +3,7 @@
struct Baser
{
enum { j, i }; // { dg-error "inaccessible" }
enum { j, i }; // { dg-message "declared" }
};
struct Base : Baser

View File

@ -4,7 +4,7 @@
struct A
{
static int i1;
int i2; // { dg-error "inaccessible" "" }
int i2; // { dg-message "declared" "" }
static void f1 ();
void f2 ();
};

View File

@ -9,7 +9,7 @@ struct A
struct B
{
private:
int next; // { dg-error "private" }
int next; // { dg-message "private" }
};
struct C

View File

@ -3,7 +3,7 @@
struct Baser
{
enum { j, i }; // { dg-error "inaccessible" }
enum { j, i }; // { dg-message "declared" }
};
struct Base : Baser

View File

@ -18,7 +18,7 @@ public:
void test();
};
int Base::fooprivate=42; // { dg-error "private" }
int Base::fooprivate=42; // { dg-message "private" }
int Base::fooprotected=42;
int Base::foopublic=42;

View File

@ -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);
};

View File

@ -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" }

View File

@ -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" }
};
};
};

View File

@ -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;
};

View File

@ -6,7 +6,7 @@
class A {
private:
void f(); // { dg-error "private" }
void f(); // { dg-message "private" }
};
class B {

View File

@ -6,7 +6,7 @@
class A {
protected:
void foo() {} // { dg-error "protected" }
void foo() {} // { dg-message "protected" }
public:
A();
};

View File

@ -7,7 +7,7 @@
struct A
{
protected:
int a; // { dg-error "protected" }
int a; // { dg-message "protected" }
};
struct B : A

View File

@ -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

View File

@ -2,7 +2,7 @@
class foo
{
typedef int memfun; // { dg-error "private" }
typedef int memfun; // { dg-message "private" }
};
template<foo::memfun> // { dg-error "context" }

View File

@ -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" }

View File

@ -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" } */

View File

@ -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 {

View File

@ -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>

View File

@ -17,7 +17,7 @@ struct B1 : B {};
struct B2 : B {};
struct C
{ // { dg-error "C" }
{ // { dg-message "declared" }
void foo(void);
};

View File

@ -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 {

View File

@ -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" }

View File

@ -9,7 +9,7 @@ public:
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;
};

View File

@ -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()

View File

@ -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>
{

View File

@ -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" }

View File

@ -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()

View File

@ -5,7 +5,7 @@
template <typename A>
class S {
class T {}; // { dg-error "private" }
class T {}; // { dg-message "private" }
};
template <typename A>

View File

@ -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;

View File

@ -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" }
};

View File

@ -10,7 +10,7 @@ template <typename T, typename U> struct F; // { dg-message "previous declaratio
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

View File

@ -7,7 +7,7 @@
template<class T> class A
{
void f (); // { dg-error "private" }
void f (); // { dg-message "private" }
};
template<class T> class B

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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>

View File

@ -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();

View File

@ -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

View File

@ -8,7 +8,7 @@ class foo {
public:
foo() {}
protected:
~foo() {} // { dg-error "~foo" }
~foo() {} // { dg-message "protected" }
};
int main()

View File

@ -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" }

View File

@ -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> {};

View File

@ -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>

View File

@ -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

View File

@ -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>

View File

@ -4,7 +4,7 @@
class x
{
typedef int privtype; // { dg-error "is private" }
typedef int privtype; // { dg-message "private" }
protected:
typedef int type;

View File

@ -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>

View File

@ -11,7 +11,7 @@ struct B
{
class type
{
type(); // { dg-error "private" }
type(); // { dg-message "private" }
};
};

View File

@ -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" }

View File

@ -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

View File

@ -6,7 +6,7 @@ public:
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(); }
};

View File

@ -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; }

View File

@ -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};
};

View File

@ -2,7 +2,7 @@
// GROUPS passed visibility
class foo {
protected:
int i; // { dg-error "" } protected
int i; // { dg-message "" } protected
};
class bar : public foo {

View File

@ -3,7 +3,7 @@
struct base
{
protected:
void base_func() {}// { dg-error "" } .*is protected.*
void base_func() {}// { dg-message "" } .*protected.*
};
struct derived : public base

View File

@ -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);
};

View File

@ -3,7 +3,7 @@
class bottom
{
public:
int b; // { dg-error "" } private
int b; // { dg-message "" } private
};
class middle : private bottom
{

View File

@ -3,7 +3,7 @@
class X
{
public:
void fn ();// { dg-error "" } .*
void fn ();// { dg-message "" } .*
};
class Y : private X
{};

View File

@ -5,7 +5,7 @@
class foo
{
public:
static int y; // { dg-error "" } private
static int y; // { dg-message "" } private
};
class foo1 : private foo
{ };

View File

@ -2,7 +2,7 @@
// GROUPS passed visibility
class A {
public:
void aMethod(void) {};// { dg-error "" } .*
void aMethod(void) {};// { dg-message "" } .*
};
class AA : A { };

View File

@ -18,7 +18,7 @@ public:
};
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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -5,7 +5,7 @@
class A
{
private:
static void foo() {} // { dg-error "" }
static void foo() {} // { dg-message "" }
public:
void goo() {}
};

View File

@ -17,24 +17,24 @@ public:
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 {

View File

@ -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);

View File

@ -6,7 +6,7 @@ public:
A();
~A();
protected:
void operator delete(void *); // { dg-error "" } protected
void operator delete(void *); // { dg-message "" } protected
};
A::~A()

View File

@ -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 ();

View File

@ -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
};

View File

@ -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);
};

View File

@ -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 {

View File

@ -13,7 +13,7 @@ public:
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 {

View File

@ -22,7 +22,7 @@ public:
Y();
};
X::X() // { dg-error "is private" }
X::X() // { dg-message "private" }
{
std::cout << "X::X()" << std::endl;
}

View File

@ -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};
};

View File

@ -3,7 +3,7 @@
#include <iostream>
class A {
A() {} // private constructor// { dg-error "" } .*
A() {} // private constructor// { dg-message "" } .*
};
int main() {

View File

@ -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
};
};

View File

@ -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 {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -31,12 +31,12 @@ private:
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);

View File

@ -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;

View File

@ -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 {

View File

@ -8,7 +8,7 @@
class Base {
protected:
void protectedBaseFunction() {} // { dg-error "" } protected
void protectedBaseFunction() {} // { dg-message "" } protected
public:
Base() {}
};

Some files were not shown because too many files have changed in this diff Show More