gcc/testsuite/g++.dg/template/recurse1.C
raw| 1 | // PR c++/5050 |
| 2 | // Origin: [email protected] |
| 3 | // Reduced by: [email protected] and Nathanael C. Nerode <[email protected]> |
| 4 | // Test for that excessive template recursion does not occur |
| 5 | // because of optimization. |
| 6 | // { dg-options "-ftemplate-depth-1 -O" } |
| 7 | |
| 8 | struct ostream { |
| 9 | template<class T> ostream& foo( const T & ) |
| 10 | { return *this; } |
| 11 | }; |
| 12 | |
| 13 | void foo() { |
| 14 | ostream os; |
| 15 | (os.foo(1)).foo(2); |
| 16 | } |