From 122d34f62660c230a978966d1c233e0bd53ded36 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 4 Jun 1998 22:20:36 -0400 Subject: [PATCH] fix From-SVN: r20235 --- .../g++.old-deja/g++.robertl/980310-2.C | 33 ---- .../g++.old-deja/g++.robertl/980310-3.C | 42 ----- .../g++.old-deja/g++.robertl/eb100.C | 173 ------------------ .../g++.old-deja/g++.robertl/eb117.C | 26 --- .../g++.old-deja/g++.robertl/eb121.C | 3 +- .../g++.old-deja/g++.robertl/eb127.C | 2 + gcc/testsuite/g++.old-deja/g++.robertl/eb26.C | 21 ++- gcc/testsuite/g++.old-deja/g++.robertl/eb27.C | 18 +- gcc/testsuite/g++.old-deja/g++.robertl/eb36.C | 28 +-- gcc/testsuite/g++.old-deja/g++.robertl/eb40.C | 7 - gcc/testsuite/g++.old-deja/g++.robertl/eb70.C | 9 +- gcc/testsuite/g++.old-deja/g++.robertl/eb72.C | 16 -- gcc/testsuite/g++.old-deja/g++.robertl/eb76.C | 8 +- gcc/testsuite/g++.old-deja/g++.robertl/eb96.C | 14 -- 14 files changed, 46 insertions(+), 354 deletions(-) delete mode 100644 gcc/testsuite/g++.old-deja/g++.robertl/980310-2.C delete mode 100644 gcc/testsuite/g++.old-deja/g++.robertl/980310-3.C delete mode 100644 gcc/testsuite/g++.old-deja/g++.robertl/eb100.C delete mode 100644 gcc/testsuite/g++.old-deja/g++.robertl/eb117.C delete mode 100644 gcc/testsuite/g++.old-deja/g++.robertl/eb40.C delete mode 100644 gcc/testsuite/g++.old-deja/g++.robertl/eb72.C delete mode 100644 gcc/testsuite/g++.old-deja/g++.robertl/eb96.C diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/980310-2.C b/gcc/testsuite/g++.old-deja/g++.robertl/980310-2.C deleted file mode 100644 index 62c152f37a5..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/980310-2.C +++ /dev/null @@ -1,33 +0,0 @@ -// float mismatch. Abors on i586-pc-linux-gnulibc1 with egcs 1.0.1 -// Should run smoothly. Aborts on i586-pc-linux-gnulibc1 -// From: Max Lawson -// Message-Id: <9803091022.AA07520@drfmc.ceng.cea.fr> - -#include - -void f(double j, double& v) -{ - size_t sz = size_t(2*j+1); - double norm_ = j*(j+1); - double m = j; - int sign_ = -1; - for (size_t c=1;c<=sz;++c) - for (size_t r=1;r<=sz;++r) - if (r+sign_*1 == c) - { - double val = (norm_-m*(m+sign_)); - for (size_t k=1;k<2;++k) - val *= (norm_ - (m+sign_*k)*(m+sign_*(k+1))); - v = val; - } -} - -int main() -{ - double v; - f(1,v); - if (v != 4) abort(); - - return 0; -} - diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/980310-3.C b/gcc/testsuite/g++.old-deja/g++.robertl/980310-3.C deleted file mode 100644 index a8c2e1988a9..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/980310-3.C +++ /dev/null @@ -1,42 +0,0 @@ -// Bug: Segfaults on egcs 1.0.1 i586-pc-linux-glibc1 -// From: Max Lawson -// Message-Id: <9803091022.AA07520@drfmc.ceng.cea.fr> - -class S0 -{ -public: - - S0() { }; - - virtual ~S0() { } -}; - - - -struct S { }; -class S1 : public S, public S0 -{ -public: - - S1() { } -}; - - -void test_ptr(void *ctxt) -{ - S0 *ctxt1 = static_cast(ctxt); - - S1* ctxt2 = dynamic_cast(ctxt1); -} - - -int main() -{ - S1 *ctxt = new S1(); - - test_ptr(ctxt); - - return 0; -} - - diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb100.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb100.C deleted file mode 100644 index fdf73969230..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb100.C +++ /dev/null @@ -1,173 +0,0 @@ -// Special g++ Options: -Wall - -#include - -template < class N, class A > -class Base -{ -public: - class NN : public N - { - friend Base; - friend ostream& operator<<(ostream &os, const NN& n) - { - n.print(os); - return os; - } - public: - void print(ostream &os) const - { - os << "Base::print()" << endl; - N::print(os); - } - }; - - typedef NN* NNPtr; - typedef list NList; - typedef NList::iterator n_list_iter; - - class n_iter : public n_list_iter - { - friend bool operator<(n_iter a, n_iter b) - { - return (a->ind() < b->ind()); - } - friend bool operator>(n_iter a, n_iter b) - { - return (a->ind() > b->ind()); - } - - public: - n_iter() {} - n_iter(n_list_iter i) : n_list_iter(i) {} - - NN& operator*() - { return *n_list_iter::operator*();}; - NN* operator->() - { return n_list_iter::operator*(); } - }; -private: - NList ns; - n_iter new_n_aux(NN* nd) - { - ns.push_back(nd); - n_iter nodi = --ns.end(); - return (nodi); - } -public: - n_iter new_n() - { - return new_n_aux(new NN()); - } - void del_n(n_iter itr) - { - NN* n = itr.operator->(); - ns.erase(itr); - delete n; - } - n_iter beg_n() { return (ns.begin()); } - n_iter end_n() { return (ns.end()); } -}; - -template -class YN : public XN -{ -public: - YN() {}; - void print(ostream& os) const - { - os << "YN::print() " << endl; - XN::print(os); - } - friend ostream& operator<< (ostream& os, const YN& wn) - { - wn.print(os); - return os; - } -}; - -template -class YA : public XA -{ -public: - YA() {}; - void print(ostream &os) const - { - os << "YA::print() " << endl; - XA::print(os); - } - - friend ostream& operator<<(ostream& os, const YA &wa) - { - wa.print(os); - return os; - } -}; - - -template -class XBase : public Base< YN, YA > -{ -public: - typedef Base< YN, YA > Net; - typedef Net::n_iter n_iter; - XBase() {}; -}; - - -class MyClass -{ -public: - struct ZN - { - void print(ostream &os) const - { - os << "MyClass::ZN::print()" << endl; - } - inline friend ostream& operator<<(ostream& os, const MyClass::ZN& nd) - { - nd.print(os); - return os; - } - }; - struct ZA - { - void print(ostream& os) const - { - os << "MyClass::ZA::print()" << endl; - } - inline friend ostream& operator<<(ostream& os, const MyClass::ZA& ar) - { - ar.print(os); - return os; - } - }; - - typedef XBase MyXBase; - typedef MyXBase::n_iter my_n_iter; - MyXBase xbase; -}; - -main () -{ - MyClass mine; - MyClass::my_n_iter n1, n2, n3, n4; - - n1 = mine.xbase.new_n(); - n2 = mine.xbase.new_n(); - n3 = mine.xbase.new_n(); - n4 = mine.xbase.new_n(); - - cout << *n1 << endl; - cout << *n2 << endl; - cout << *n3 << endl; - cout << *n4 << endl; - - mine.xbase.del_n(n1); - mine.xbase.del_n(n2); - mine.xbase.del_n(n3); - mine.xbase.del_n(n4); -} - - - diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb117.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb117.C deleted file mode 100644 index 492abb8bb38..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb117.C +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -struct F { - int i; -}; - -F f; - -int main( int, char** ) { - - int F:: *of; - int *i = (int *) &of; - of = &F::i; - - F *b = ((F*) ((int) &f.i - *i)); - F *a = &f; - - - printf("%d\n", a-b); - printf("%d\n", b-a); - - assert( (a-b) == -(b-a) ); // will fail with egcs-1.0 - - return 0; -} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C index 86be02a0af0..456615d67c5 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C @@ -3,7 +3,7 @@ class A { private: int i1_; public: - void f(int const i1 = 1); // ERROR - + void f(int const i1 = 1); // ERROR - previous specification }; void @@ -19,4 +19,3 @@ main() a.f(); return 0; } - diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb127.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb127.C index b727818ff2e..cf5f69fc1a6 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb127.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb127.C @@ -1,3 +1,5 @@ +// Gets ICE 40. + #include #include diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C index 38d51bcef3b..8e0d0f85ea0 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C @@ -6,18 +6,23 @@ class foo { +public: + static int f(); + class bar { + friend int foo::f(); +// friend int f(); + static int x; public: - static int f(); - class bar { - friend int foo::f(); -// friend int f(); - static int x; - public: - static int f() {return foo::f();}; + static int f() {return foo::f();}; }; }; int foo::f() { - return bar::x; + return bar::x; } +int +main () +{ + return foo::bar::f (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C index 3b0ffd6afb3..d85ed38c7f2 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C @@ -2,9 +2,13 @@ /* simple program to demonstrate the bug with named return values in gcc */ /* (w) 4.9.97 by Kurt Garloff */ +// Special g++ Options: #include +template class test; +template test operator + (const test& a, const test& b); + // A simple numerical class template class test @@ -14,29 +18,19 @@ class test test () { elem = 0; }; test (const T& a) { elem = a; }; test& operator += (const test& a) { elem += a.elem; return *this; }; - friend test operator + (const test&, const test&); + friend test operator + <> (const test&, const test&); friend ostream& operator << (ostream& os, const test& a) { return os << a.elem; }; }; -#ifndef NOBUG // named return value version template test operator + (const test& a, const test& b) return c(a); { c += b; }; -#else -// equiv. version without named ret val -template -test operator + (const test& a, const test& b) -{ test c(a); c += b; return c; }; - -#endif - int main() { test x, y; x += 5; cout << x << endl; - y = x + 2; cout << y << endl; + y = x + test(2); cout << y << endl; } - diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C index 07fc4c52663..542cbebc6ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C @@ -1,15 +1,19 @@ - #include +// Build don't link: - template class foo { - public: - foo(); - foo(vector v); - private: - vector v; - T t; - }; +#include - template foo::foo() :v(), t() {} - template foo::foo(vector v_) :v(v_), t() {} +template class foo { +public: + foo(); + foo(vector v); +private: + vector v; + T t; +}; - foo a; +template +foo::foo() :v(), t() {} +template // ERROR - default parm for member template +foo::foo(vector v_) :v(v_), t() {} + +foo a; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb40.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb40.C deleted file mode 100644 index 2529fef9dd5..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb40.C +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void foo() { - complex x(0, 0); - complex y = 1.0 + x; // OK - complex z = 1 + x; // line 6: <<<< 1 doesn't match double -} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C index 346eda2c91c..63a6de0a21f 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C @@ -1,4 +1,6 @@ -// Build don't link: +// conversion ops should be treated as coming from the most derived class +// for overload resolution. See [over.match.funcs]. +// Build don't link: class X { public: @@ -11,7 +13,6 @@ private: }; -void f(Y const& y) { - if( bool(y) ) { - } +int f(Y const& y) { + return bool(y); } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb72.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb72.C deleted file mode 100644 index fbdf5079554..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb72.C +++ /dev/null @@ -1,16 +0,0 @@ -#include - -template -class TPROGRAM - { - typedef vector< T > ITEMS; - - class const_iterator - { - /*typename*/ ITEMS::const_iterator i; - - const_iterator(const /*typename*/ ITEMS::const_iterator i2) { - i=i2; - } - }; - }; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C index 80cccc8a0d3..61920c592be 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C @@ -1,9 +1,7 @@ //Build don't link: -// from include/g++/stl_relops.h -template -inline bool operator!=(const T& x, const T& y) { - return !(x == y); -} +// the template operator!= interferes. It should be in a namespace. + +#include enum T { V1 diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb96.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb96.C deleted file mode 100644 index 840b2d877e6..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb96.C +++ /dev/null @@ -1,14 +0,0 @@ -class foo -{ - public: - static int f(); - - class bar { - friend int foo::f(); - }; -}; - -int main() -{ - return 0; -} -- 2.30.2