// ICE in explicit instantiation of a function with contracts // { dg-do run } // { dg-options "-std=c++20 -fcontracts -fcontract-continuation-mode=on" } template void foo(T t) [[pre : t == 9 ]] { } template void foo(int i); template struct templateS { void fooS(T t) [[pre : t == 9 ]] { } }; template struct templateS; struct S { template void fooS(T t) [[pre : t == 9 ]] { } template static void fooStatic(T t) [[pre : t == 9 ]] { } }; template void S::fooS(int i); template void S::fooStatic(int i); int main() { foo(3); templateS ts; ts.fooS(3); S s; s.fooS(3); S::fooStatic(3); } // { dg-output "contract violation in function foo at .* t == 9.*(\n|\r\n|\r)" } // { dg-output "contract violation in function templateS::fooS at .* t == 9.*(\n|\r\n|\r)" } // { dg-output "contract violation in function S::fooS at .* t == 9.*(\n|\r\n|\r)" } // { dg-output "contract violation in function S::fooStatic at .* t == 9.*(\n|\r\n|\r)" }