gcc/testsuite/g++.old-deja/g++.jason/template24.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } } |
| 3 | // Bug: g++ doesn't find the conversion from ostream_withassign to ostream. |
| 4 | |
| 5 | #include <iostream> |
| 6 | |
| 7 | template <class T> |
| 8 | struct A { |
| 9 | T t; |
| 10 | }; |
| 11 | |
| 12 | template <class T> |
| 13 | std::ostream & operator<< (std::ostream & os, A<T> & a) |
| 14 | { |
| 15 | os << a.t; |
| 16 | return os; |
| 17 | } |
| 18 | |
| 19 | int main () |
| 20 | { |
| 21 | A<int> a = { 1 }; |
| 22 | std::cout << a << std::endl; |
| 23 | } |
| 24 |