+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>
PR c++/51397
tree decl;
tree identifier;
tree qscope;
+ int oldcount = errorcount;
+ cp_token *diag_token = NULL;
if (access_declaration_p)
- cp_parser_parse_tentatively (parser);
+ {
+ diag_token = cp_lexer_peek_token (parser->lexer);
+ cp_parser_parse_tentatively (parser);
+ }
else
{
/* Look for the `using' keyword. */
/* Look for the final `;'. */
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;
}
+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>
PR fortran/51502
struct B : public A
{
- A::d;
+ A::d; // { dg-warning "deprecated" }
};
B b;
class B : private A
{
public:
- A::i;
- A::A1;
+ A::i; // { dg-warning "deprecated" }
+ A::A1; // { dg-warning "deprecated" }
};
void
extern "C" struct B : A
{
- A::i;
+ A::i; // { dg-warning "deprecated" }
};
// PR c++/51382
// { dg-do compile }
+// { dg-options "-Wno-deprecated" }
template< int Value >
struct Base
{
typedef typename A<T>::B X;
X::Y; // { dg-error "not a base type" }
+// { dg-warning "deprecated" "" { target *-*-* } 15 }
};
C<void> c;
template <typename T> class I : public B {};
template <typename T> class D : private I<T> {
- I<T>::B::foo;
+ I<T>::B::foo; // { dg-warning "deprecated" }
};
I (int capacity) { allocateBuffer (capacity); }
~I () { this->deallocateBuffer (buffer ()); }
using H <T>::allocateBuffer;
- H <T>::buffer;
+ H <T>::buffer; // { dg-warning "deprecated" }
};
template <typename T, int cap = 0> struct J
{
class buff_head : private port_head {
public:
static int rep;
- port_head::cap;
+ port_head::cap; // { dg-warning "deprecated" }
};
// { dg-do assemble }
-// { dg-options "" }
+// { dg-options "-Wno-deprecated" }
// GROUPS passed old-abort
const bool FALSE = 0;
class B: private A {
public:
- A::foo;
+ A::foo; // { dg-warning "deprecated" }
};
void foo() {
B b;
- b.foo (); // { dg-bogus "" }
+ b.foo (); // { dg-bogus "" }
}
template <class T> class B: private T {
public:
- T::t; // { dg-bogus "" } doesn't recognize access decl
+ T::t; // { dg-warning "deprecated" }
};
template class B<A<int> >;
class mel : private inh {
protected:
int t;
- inh::myf;
+ inh::myf; // { dg-warning "deprecated" }
};
class top_t : protected mel {
class C : private B {
public:
- B::func;
+ B::func; // { dg-warning "deprecated" }
};
class D {
class B : private A {
protected:
- A::f;
+ A::f; // { dg-warning "deprecated" }
public:
- A::g;
+ A::g; // { dg-warning "deprecated" }
};
class Y : private X {
public:
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" }
};
void remove(T *p) { IListBase::remove(p); }
T *head() { return (T *)IListBase::head(); }
T *get() { return (T *)IListBase::get(); }
- IListBase::empty;
+ IListBase::empty; // { dg-warning "deprecated" }
friend class IListIter<T>;
};
public:
IListIter(const IList<T> &list) : IListIterBase(list) { }
T *cur() { return (T *)IListIterBase::cur(); }
- IListIterBase::next;
- IListIterBase::done;
+ IListIterBase::next; // { dg-warning "deprecated" }
+ IListIterBase::done; // { dg-warning "deprecated" }
};
struct B: private virtual A
{
- A::f;
+ A::f; // { dg-warning "deprecated" }
};
struct C: private virtual A, public B
class B : private A
{
protected:
- A::i;
+ A::i; // { dg-warning "deprecated" }
};
struct C : public B {