diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/template/cond.C')
-rw-r--r-- | gcc/testsuite/g++.dg/template/cond.C | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/cond.C b/gcc/testsuite/g++.dg/template/cond.C new file mode 100644 index 000000000..394a21c9a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/cond.C @@ -0,0 +1,23 @@ +// PR c++/8080 + +// Bug: the transformation in finish_while_stmt_cond produced something +// that tsubst_expr handled badly. Fixed by not doing the transformation +// while parsing a template. + +class TObject {}; + +struct TIter { + TObject *operator()(); +}; + + +template<class T> +void get_root_object(TIter& iobj) { + while ( TObject* pnew_obj = iobj() ) + ; +} + +void foo(TIter& iobj) +{ + get_root_object<int>(iobj); +} |