1// PR c++/5050 2// Origin: georg.wild@gmx.de 3// Reduced by: tbagot@bluearc.com and Nathanael C. Nerode <neroden@twcny.rr.com> 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 } 17