eb27.C: Convert.
2001-05-15 Benjamin Kosnik <bkoz@redhat.com> * g++.old-deja/g++.robertl/eb27.C: Convert. From-SVN: r42126
This commit is contained in:
parent
99d8dccc07
commit
5846d7f734
2 changed files with 10 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
|||
2001-05-15 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* g++.old-deja/g++.robertl/eb27.C: Convert.
|
||||
|
||||
2001-05-15 Nick Clifton <nickc@cambridge.redhat.com>
|
||||
|
||||
* g++.dg/friend-warn.C: New test. Do not warn about friend
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// for the test<T> record_type. This is marked as an expected failure for now,
|
||||
// until we actually fix it.
|
||||
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
|
||||
template <class T> class test;
|
||||
template <class T> test<T> operator + (const test<T>& a, const test<T>& b);
|
||||
|
@ -22,7 +22,7 @@ class test
|
|||
test (const T& a) { elem = a; };
|
||||
test<T>& operator += (const test<T>& a) { elem += a.elem; return *this; };
|
||||
friend test<T> operator + <> (const test<T>&, const test<T>&);
|
||||
friend ostream& operator << (ostream& os, const test<T>& a)
|
||||
friend std::ostream& operator << (std::ostream& os, const test<T>& a)
|
||||
{ return os << a.elem; };
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,8 @@ test<T> operator + (const test<T>& a, const test<T>& b) return c(a);
|
|||
int main()
|
||||
{
|
||||
test<int> x, y;
|
||||
x += 5; cout << x << endl;
|
||||
y = x + test<int>(2); cout << y << endl;
|
||||
x += 5;
|
||||
std::cout << x << std::endl;
|
||||
y = x + test<int>(2);
|
||||
std::cout << y << std::endl;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue