diff options
Diffstat (limited to 'gcc/testsuite')
22 files changed, 84 insertions, 38 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f40783f0488..55e4028613f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,33 @@ +2003-01-16 Mark Mitchell <mark@codesourcery.com> + + * gcc/testsuite/g++.dg/ext/typename1.C: Add typename keyword. + * gcc/testsuite/g++.dg/template/crash1.C: Update error messages. + * gcc/testsuite/g++.dg/template/crash2.C: Remove error message. + * gcc/testsuite/g++.dg/parse/typename2.C: New test. + * gcc/testsuite/g++.dg/template/typename2.C: Change implicit + typename warning into error. + * gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C: Issue more + error messages. + * gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C: Fix typos. + * gcc/testsuite/g++.old-deja/g++.brendan/crash56.C: Add this->. + * gcc/testsuite/g++.old-deja/g++.law/visibility13.C: Remove error + messages. + * gcc/testsuite/g++.old-deja/g++.ns/template17.C: Reorder code to + make declaration visible in template. + * gcc/testsuite/g++.old-deja/g++.pt/crash3.C: Fix typos. + * gcc/testsuite/g++.old-deja/g++.pt/crash36.C: Issue more error + messages. + * gcc/testsuite/g++.old-deja/g++.pt/crash5.C: Improve error + message. + * gcc/testsuite/g++.old-deja/g++.pt/crash67.C: Remove warning. + * gcc/testsuite/g++.old-deja/g++.pt/inherit1.C: Add this->. + * gcc/testsuite/g++.old-deja/g++.pt/niklas01a.C: Add error message. + * gcc/testsuite/g++.old-deja/g++.pt/typename16.C: Replace implicit + typename warning with error message. + * gcc/testsuite/g++.old-deja/g++.pt/typename19.C: Remove warning. + * gcc/testsuite/g++.old-deja/g++.robertl/eb112.C: Fix typo. + * gcc/testsuite/g++.old-deja/g++.robertl/eb24.C: Use this->. + 2003-01-16 Nathan Sidwell <nathan@codesourcery.com> * g++.dg/parse/ambig2.C: New test. diff --git a/gcc/testsuite/g++.dg/ext/typename1.C b/gcc/testsuite/g++.dg/ext/typename1.C index f66210ff506..cb9f4a7fc6c 100644 --- a/gcc/testsuite/g++.dg/ext/typename1.C +++ b/gcc/testsuite/g++.dg/ext/typename1.C @@ -3,5 +3,5 @@ template <class T> struct A { typedef int X; }; template <class T> struct B { typedef A<T> Y; void f (typename Y::X); }; -template <class T, class T1, class T2, class T3> struct C : public B<T> { void g (typename Y::X); }; +template <class T, class T1, class T2, class T3> struct C : public B<T> { void g (typename B<T>::Y::X); }; template class B<int>; diff --git a/gcc/testsuite/g++.dg/parse/typename2.C b/gcc/testsuite/g++.dg/parse/typename2.C new file mode 100644 index 00000000000..8878497ad2f --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/typename2.C @@ -0,0 +1,17 @@ +template<class T, class U> +struct UnaryReturn { + typedef T Type_t; +}; + +struct foo +{ + template <class T> + typename UnaryReturn<T, int>::Type_t + bar(); +}; + +template<class T> +struct UnaryReturn<T, int> { + typedef bool Type_t; +}; + diff --git a/gcc/testsuite/g++.dg/template/crash1.C b/gcc/testsuite/g++.dg/template/crash1.C index 3879ad5abda..16d584e0fbb 100644 --- a/gcc/testsuite/g++.dg/template/crash1.C +++ b/gcc/testsuite/g++.dg/template/crash1.C @@ -1,6 +1,6 @@ // { dg-do compile } -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 29 Dec 2001 <nathan@codesourcery.com> // PR 5125. ICE @@ -12,6 +12,6 @@ class S }; template <class I> -void S::Foo(int (*f)(TYPO&o) ) // { dg-error "Foo" } +void S::Foo(int (*f)(TYPO&o) ) // { dg-error "Foo|f|TYPO|o" } { // { dg-error "expected `;'" } } diff --git a/gcc/testsuite/g++.dg/template/crash2.C b/gcc/testsuite/g++.dg/template/crash2.C index e6cc965ff03..a02787a46fa 100644 --- a/gcc/testsuite/g++.dg/template/crash2.C +++ b/gcc/testsuite/g++.dg/template/crash2.C @@ -17,7 +17,7 @@ enum E { max = 5 }; struct B { - A<E> a; // { dg-error "" } + A<E> a; }; } diff --git a/gcc/testsuite/g++.dg/template/typename2.C b/gcc/testsuite/g++.dg/template/typename2.C index 0ca1163f425..644c62a7f4c 100644 --- a/gcc/testsuite/g++.dg/template/typename2.C +++ b/gcc/testsuite/g++.dg/template/typename2.C @@ -1,7 +1,7 @@ // { dg-do compile } // { dg-options "" } -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 21 Mar 2002 <nathan@codesourcery.com> // PR 5507. Overzealous implicit typename warning @@ -21,5 +21,5 @@ class ctype : public __ctype_abstract_base<_CharT> template<typename _CharT> class ctype2 : public __ctype_abstract_base<_CharT> { - typedef mask mask; // { dg-warning "(implicitly a typename)|(implicit typename)" "" } + typedef mask mask; // { dg-error "" } }; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C index 1dae2a97eae..80490e92551 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C @@ -127,7 +127,7 @@ public: friend bool foo(T161 u) { Xseven<T161, 5, int> obj; // ERROR - .* - return (obj.inst == u.inst); + return (obj.inst == u.inst); // ERROR - .* } }; @@ -192,10 +192,10 @@ template <long l>// ERROR - .* struct Xthirteen { template <long l> long comp_ge(long test) {// ERROR - . long local_value; - if (local_value > value) + if (local_value > value) // ERROR - .* return local_value; else - return value; + return value; // ERROR - .* } }; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C index 0330d0bbd0a..3c01be739bc 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C @@ -115,7 +115,7 @@ protected: template <class T17, int i> struct Xtwenty { void f(){ T17 my_type; //ok - for (int j = 0; j < 5; ++l) + for (int j = 0; j < 5; ++j) { T17 my_type; //ok ++my_type; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C index fc6af32938c..0523f1fe31b 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C @@ -51,7 +51,7 @@ unsigned short X_one<T>::ret_id() { export template <class T2> // WARNING - bool compare_ge(T2 test) { - if (test > type) + if (test > type) // ERROR - .* return true; return false; } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C index 739dfcba030..78c291bf4c5 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C @@ -273,10 +273,10 @@ template<class T> void SetLD<T>::remove(const T& item) { - typename ListD<T>::Action a = NORMAL; + typename ListD<T>::Action a = this->NORMAL; Vix x; - for (first(x); 0 != x && REMOVE_CURRENT != a; next(x, a)) - a = operator()(x) == item ? REMOVE_CURRENT: NORMAL;// ERROR - .* + for (first(x); 0 != x && this->REMOVE_CURRENT != a; next(x, a)) + a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // ERROR - .* } template<class T> bool diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility13.C b/gcc/testsuite/g++.old-deja/g++.law/visibility13.C index 472d5a2da81..2a741512423 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility13.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility13.C @@ -25,8 +25,8 @@ public: virtual Type& operator[](int ix) { return ia[ix]; } private: void init(const Type*, int); - int size; // ERROR - private - int *ia; // ERROR - private + int size; + int *ia; }; template <class Type> diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template17.C b/gcc/testsuite/g++.old-deja/g++.ns/template17.C index 11f21c921e1..a441ebe5b2a 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/template17.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/template17.C @@ -1,6 +1,6 @@ // Build don't link: // -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 29 Apr 2001 <nathan@codesourcery.com> // Bug 2258. We failed to implement using directives inside template @@ -16,6 +16,11 @@ namespace whatever template <typename T> void fn (T, T (*)(T)); +namespace whatever +{ + template <typename T> T end3 (T); +} + template <class T> void mycout(const T& data) { using namespace thing; @@ -25,11 +30,6 @@ template <class T> void mycout(const T& data) fn (data, end3); } -namespace whatever -{ - template <typename T> T end3 (T); -} - int main() { double data = 5.0; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash3.C b/gcc/testsuite/g++.old-deja/g++.pt/crash3.C index 0d2a7cd935d..a6133e17344 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash3.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash3.C @@ -5,12 +5,12 @@ class CVector { public: CVector<int> f() const { - CVector<int> v(n); + CVector<int> v(); return v; } CVector<long> g() const { - CVector<long> v(n); + CVector<long> v(); return v; } }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash36.C b/gcc/testsuite/g++.old-deja/g++.pt/crash36.C index f9cbed2c60e..938591fd13e 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash36.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash36.C @@ -29,7 +29,7 @@ struct list { reverse_iterator<list_iterator<T> > rbegin() { return reverse_iterator<list_iterator<T> > // ERROR - no type|instantiated here - (list_iterator<T>(Head->next())); } + (list_iterator<T>(Head->next())); } // ERROR - not declared }; template class list<int>; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash5.C b/gcc/testsuite/g++.old-deja/g++.pt/crash5.C index 99a77916287..c36f5d786c3 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash5.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash5.C @@ -1,12 +1,12 @@ // Build don't link: template <class T, int i> -struct K { // ERROR - forward declaration +struct K { void f(); }; template <class T> void -K<T, i>::f() -{ // ERROR - template parameters +K<T, i>::f() // ERROR - i has not been declared +{ } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash67.C b/gcc/testsuite/g++.old-deja/g++.pt/crash67.C index b532e3d22e9..646763a4be7 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash67.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash67.C @@ -1,7 +1,7 @@ // Build don't link: // Special g++ Options: // -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 6 May 2001 <nathan@codesourcery.com> // Bug 2526. We ICE'd after diagnosing dependent name confusion in @@ -16,5 +16,5 @@ struct B template<typename T> struct D : B<T> { - friend class Mother; // WARNING - defines namespace class + friend class Mother; }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/inherit1.C b/gcc/testsuite/g++.old-deja/g++.pt/inherit1.C index 6ae70c1bb9e..3fb56565435 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/inherit1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/inherit1.C @@ -14,7 +14,7 @@ template <int dim> class FinalClass : public Derived<dim> { public: FinalClass () { - if (&local1 != &local2) + if (&this->local1 != &this->local2) i = 0; } }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/niklas01a.C b/gcc/testsuite/g++.old-deja/g++.pt/niklas01a.C index 027f2ae9595..131964b4375 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/niklas01a.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/niklas01a.C @@ -1,6 +1,6 @@ // Build don't link: -struct A { +struct A { // ERROR - forward declaration friend struct B : A { // ERROR - int x; }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename16.C b/gcc/testsuite/g++.old-deja/g++.pt/typename16.C index 225cc894a05..f40a6a28229 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/typename16.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename16.C @@ -11,7 +11,7 @@ struct D1 : public B { template <class T> struct D2 : public D1<T> { - I i; // WARNING - implicit typename + I i; // ERROR - not a type }; template <> @@ -27,5 +27,5 @@ void f(double) {} int main() { D2<int> d2i; - f(d2i.i); + f(d2i.i); // ERROR - no member i } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename19.C b/gcc/testsuite/g++.old-deja/g++.pt/typename19.C index be93a983267..332f294d7cf 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/typename19.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename19.C @@ -12,7 +12,7 @@ struct S { template <class U> struct I : public O<U> { - static X x; // WARNING - lookup finds S<T>::X + static X x; }; }; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb112.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb112.C index 3233287ff10..c0231b70955 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb112.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb112.C @@ -4,8 +4,7 @@ setback(MEMBER *bp, MEMBER STRUCT::*offset) { // The implementation of this function may be platform dependend if(!bp) return 0; // NULL pointers remain NULL - union { int i; MEMBER STRUCT::*of; } u; // Switch types. Casting won't -+work. + union { int i; MEMBER STRUCT::*of; } u; // Switch types. Casting won't work. u.of = offset; return (STRUCT *) ((int) bp - u.i); } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb24.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb24.C index 7ea7b41205b..528af4c4dee 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb24.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb24.C @@ -19,5 +19,5 @@ class Y : public X<T> using X<T>::x; - void f () { std::cout << x << std::endl; } + void f () { std::cout << this->x << std::endl; } }; |

