crash25.C: Adjust.

gcc/testsuite/ChangeLog

2011-12-31  Fabien Chene  <fabien@gcc.gnu.org>

	* g++.old-deja/g++.brendan/crash25.C: Adjust.
	* g++.old-deja/g++.brendan/crash56.C: Likewise.
	* g++.old-deja/g++.jason/access14.C: Likewise.
	* g++.old-deja/g++.jason/access8.C: Likewise.
	* g++.old-deja/g++.jason/access1.C: Likewise.
	* g++.old-deja/g++.other/access3.C: Likewise.
	* g++.old-deja/g++.other/access5.C: Likewise.
	* g++.old-deja/g++.law/unsorted1.C: Likewise.
	* g++.old-deja/g++.law/visibility22.C: Likewise.
	* g++.old-deja/g++.law/visibility26.C: Likewise.
	* g++.old-deja/g++.mike/p2746.C: Likewise.
	* g++.dg/debug/using1.C: Likewise.
	* g++.dg/lookup/using51.C: Likewise.
	* g++.dg/inherit/using5.C: Likewise.
	* g++.dg/inherit/pr30297.C: Likewise.
	* g++.dg/inherit/access8.C: Likewise.
	* g++.dg/torture/pr39362.C: Likewise.
	* g++.dg/template/crash13.C: Likewise.
	* g++.dg/template/using10.C: Likewise.

gcc/cp/ChangeLog

2011-12-31  Fabien Chene  <fabien@gcc.gnu.org>

	* parser.c (cp_parser_using_declaration): Add a warning about
	deprecated access declarations when no errors were encountered
	while parsing the access declaration. Save the first token in
	order to emit the warning at the right place.

From-SVN: r182772
This commit is contained in:
Fabien Chêne 2012-01-01 18:26:23 +01:00
parent b4cbc46c32
commit 5135baed7d
21 changed files with 67 additions and 23 deletions

View File

@ -1,3 +1,10 @@
2011-12-31 Fabien Chêne <fabien@gcc.gnu.org>
* parser.c (cp_parser_using_declaration): Add a warning about
deprecated access declarations when no errors were encountered
while parsing the access declaration. Save the first token in
order to emit the warning at the right place.
2011-12-31 Paolo Carlini <paolo.carlini@oracle.com> 2011-12-31 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51397 PR c++/51397

View File

@ -14887,9 +14887,14 @@ cp_parser_using_declaration (cp_parser* parser,
tree decl; tree decl;
tree identifier; tree identifier;
tree qscope; tree qscope;
int oldcount = errorcount;
cp_token *diag_token = NULL;
if (access_declaration_p) if (access_declaration_p)
cp_parser_parse_tentatively (parser); {
diag_token = cp_lexer_peek_token (parser->lexer);
cp_parser_parse_tentatively (parser);
}
else else
{ {
/* Look for the `using' keyword. */ /* Look for the `using' keyword. */
@ -15001,6 +15006,12 @@ cp_parser_using_declaration (cp_parser* parser,
/* Look for the final `;'. */ /* Look for the final `;'. */
cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON); cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON);
if (access_declaration_p && errorcount == oldcount)
warning_at (diag_token->location, OPT_Wdeprecated,
"access declarations are deprecated "
"in favour of using-declarations; "
"suggestion: add the %<using%> keyword");
return true; return true;
} }

View File

@ -1,3 +1,25 @@
2011-12-31 Fabien Chêne <fabien@gcc.gnu.org>
* g++.old-deja/g++.brendan/crash25.C: Adjust.
* g++.old-deja/g++.brendan/crash56.C: Likewise.
* g++.old-deja/g++.jason/access14.C: Likewise.
* g++.old-deja/g++.jason/access8.C: Likewise.
* g++.old-deja/g++.jason/access1.C: Likewise.
* g++.old-deja/g++.other/access3.C: Likewise.
* g++.old-deja/g++.other/access5.C: Likewise.
* g++.old-deja/g++.law/unsorted1.C: Likewise.
* g++.old-deja/g++.law/visibility22.C: Likewise.
* g++.old-deja/g++.law/visibility26.C: Likewise.
* g++.old-deja/g++.mike/p2746.C: Likewise.
* g++.dg/debug/using1.C: Likewise.
* g++.dg/lookup/using51.C: Likewise.
* g++.dg/inherit/using5.C: Likewise.
* g++.dg/inherit/pr30297.C: Likewise.
* g++.dg/inherit/access8.C: Likewise.
* g++.dg/torture/pr39362.C: Likewise.
* g++.dg/template/crash13.C: Likewise.
* g++.dg/template/using10.C: Likewise.
2012-01-01 Thomas Koenig <tkoenig@gcc.gnu.org> 2012-01-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/51502 PR fortran/51502

View File

@ -9,7 +9,7 @@ struct A
struct B : public A struct B : public A
{ {
A::d; A::d; // { dg-warning "deprecated" }
}; };
B b; B b;

View File

@ -13,8 +13,8 @@ public:
class B : private A class B : private A
{ {
public: public:
A::i; A::i; // { dg-warning "deprecated" }
A::A1; A::A1; // { dg-warning "deprecated" }
}; };
void void

View File

@ -7,5 +7,5 @@ struct A
extern "C" struct B : A extern "C" struct B : A
{ {
A::i; A::i; // { dg-warning "deprecated" }
}; };

View File

@ -1,5 +1,6 @@
// PR c++/51382 // PR c++/51382
// { dg-do compile } // { dg-do compile }
// { dg-options "-Wno-deprecated" }
template< int Value > template< int Value >
struct Base struct Base

View File

@ -13,6 +13,7 @@ template <typename T> struct C
{ {
typedef typename A<T>::B X; typedef typename A<T>::B X;
X::Y; // { dg-error "not a base type" } X::Y; // { dg-error "not a base type" }
// { dg-warning "deprecated" "" { target *-*-* } 15 }
}; };
C<void> c; C<void> c;

View File

@ -7,5 +7,5 @@ struct B {
template <typename T> class I : public B {}; template <typename T> class I : public B {};
template <typename T> class D : private I<T> { template <typename T> class D : private I<T> {
I<T>::B::foo; I<T>::B::foo; // { dg-warning "deprecated" }
}; };

View File

@ -57,7 +57,7 @@ template <typename T> struct I <T, 0> : H <T>
I (int capacity) { allocateBuffer (capacity); } I (int capacity) { allocateBuffer (capacity); }
~I () { this->deallocateBuffer (buffer ()); } ~I () { this->deallocateBuffer (buffer ()); }
using H <T>::allocateBuffer; using H <T>::allocateBuffer;
H <T>::buffer; H <T>::buffer; // { dg-warning "deprecated" }
}; };
template <typename T, int cap = 0> struct J template <typename T, int cap = 0> struct J
{ {

View File

@ -14,5 +14,5 @@ public:
class buff_head : private port_head { class buff_head : private port_head {
public: public:
static int rep; static int rep;
port_head::cap; port_head::cap; // { dg-warning "deprecated" }
}; };

View File

@ -1,5 +1,5 @@
// { dg-do assemble } // { dg-do assemble }
// { dg-options "" } // { dg-options "-Wno-deprecated" }
// GROUPS passed old-abort // GROUPS passed old-abort
const bool FALSE = 0; const bool FALSE = 0;

View File

@ -8,10 +8,10 @@ public:
class B: private A { class B: private A {
public: public:
A::foo; A::foo; // { dg-warning "deprecated" }
}; };
void foo() { void foo() {
B b; B b;
b.foo (); // { dg-bogus "" } b.foo (); // { dg-bogus "" }
} }

View File

@ -4,7 +4,7 @@ template <class T> struct A { T t; };
template <class T> class B: private T { template <class T> class B: private T {
public: public:
T::t; // { dg-bogus "" } doesn't recognize access decl T::t; // { dg-warning "deprecated" }
}; };
template class B<A<int> >; template class B<A<int> >;

View File

@ -12,7 +12,7 @@ protected:
class mel : private inh { class mel : private inh {
protected: protected:
int t; int t;
inh::myf; inh::myf; // { dg-warning "deprecated" }
}; };
class top_t : protected mel { class top_t : protected mel {

View File

@ -20,7 +20,7 @@ class B : public A {
class C : private B { class C : private B {
public: public:
B::func; B::func; // { dg-warning "deprecated" }
}; };
class D { class D {

View File

@ -19,7 +19,7 @@ public:
class B : private A { class B : private A {
protected: protected:
A::f; A::f; // { dg-warning "deprecated" }
public: public:
A::g; A::g; // { dg-warning "deprecated" }
}; };

View File

@ -14,5 +14,7 @@ class X {
class Y : private X { class Y : private X {
public: public:
void f(int); void f(int);
X::f; // used to be an error; now equivalent to 'using X::f'
// 'X::f' used to be an error; now equivalent to 'using X::f'
X::f; // { dg-warning "deprecated" }
}; };

View File

@ -86,7 +86,7 @@ public:
void remove(T *p) { IListBase::remove(p); } void remove(T *p) { IListBase::remove(p); }
T *head() { return (T *)IListBase::head(); } T *head() { return (T *)IListBase::head(); }
T *get() { return (T *)IListBase::get(); } T *get() { return (T *)IListBase::get(); }
IListBase::empty; IListBase::empty; // { dg-warning "deprecated" }
friend class IListIter<T>; friend class IListIter<T>;
}; };
@ -136,8 +136,8 @@ class IListIter : private IListIterBase {
public: public:
IListIter(const IList<T> &list) : IListIterBase(list) { } IListIter(const IList<T> &list) : IListIterBase(list) { }
T *cur() { return (T *)IListIterBase::cur(); } T *cur() { return (T *)IListIterBase::cur(); }
IListIterBase::next; IListIterBase::next; // { dg-warning "deprecated" }
IListIterBase::done; IListIterBase::done; // { dg-warning "deprecated" }
}; };

View File

@ -10,7 +10,7 @@ struct A
struct B: private virtual A struct B: private virtual A
{ {
A::f; A::f; // { dg-warning "deprecated" }
}; };
struct C: private virtual A, public B struct C: private virtual A, public B

View File

@ -9,7 +9,7 @@ protected:
class B : private A class B : private A
{ {
protected: protected:
A::i; A::i; // { dg-warning "deprecated" }
}; };
struct C : public B { struct C : public B {