------- Comment #2 from reichelt at gcc dot gnu dot org 2009-06-06 22:54 ------- The original testcase doesn't crash anymore, but now an even simpler version crashes:
============================================================================ double sqrt(double x) { double d; asm("" : "=t"(d) : "0"(x)); return d; } struct A { A(); int i; int* p; }; int foo(const A& a) { int s = 0; for (int i = 0; i < a.i; ++i) s += a.p[i]; return s; } template<int> struct B { static const bool b = true; }; template<int N, bool = B<N>::b> struct C {}; template<int> void bar(const C<0>&, const A& a, bool b = true) { A x; int d = sqrt(foo(a)); if (b) d = 1; } void baz() { A a; bar<0>(C<0>(), a); bar<0>(C<0>(), a); } ============================================================================ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40140