Rebase.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.pt / infinite1.C
blob1e2a9f0fbddab9dc0e22070b1c47e0a26341db8c
1 // { dg-do assemble  }
2 // { dg-options "-ftemplate-depth-10" }
3 // Test for catching infinitely recursive instantiations.
4 // Origin: Jason Merrill <jason@redhat.com>
7 template <int i> void f()
9   f<i+1>();                     // { dg-error "" } excessive recursion
12 // We should never need this specialization because we should issue an
13 // error first about the recursive template instantions.  But, in case
14 // the compiler fails to catch the error, this will keep it from
15 // running forever instantiating more and more templates.
16 template <> void f<11>();
18 int main()
20   f<0>();
23 // { dg-prune-output "note" }