https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82159
--- Comment #8 from chr at terma dot com --- (In reply to Jakub Jelinek from comment #7) > If you can't provide a testcase, then we can't do anything with it. > If the inability to provide a testcase is because it contains some > proprietary stuff that can't be made public, you always have the option to > reduce the testcase sufficiently that it is small enough to be releasable > (perhaps after also changing identifiers). > See https://gcc.gnu.org/wiki/A_guide_to_testcase_reduction for details how > to do that. Hello, I've tried creduce, worked like a charm. Following test case fails with -O0, but works with -O1-3. Source file testcase.cpp: ------------- class d; template <typename f> class g { f e; }; class h : g<int[0]> { public: template <typename i> d operator-(i); }; class d : public h { public: d(const d &); }; class l : public d { public: template <class j> l(j); }; template <class an> class m { public: typedef typename an::template n<m> ap; }; template <class aq> class o { typename m<aq>::ap as; }; class D { public: l av; }; template <class aw> class p : aw { public: template <typename ay, typename az> p(ay p1, az q) : aw(p1, q) {} D *ba; virtual void b() { aw::bc(ba); } }; template <int, typename> class bj; template <class> class bm { public: typedef int bi; class bn {}; template <class bo> class bp { public: l bq; bp(bi, bo q) : bq(q.av - 0) {} }; bm(bi, bn); }; template <typename> class r; template <int bd, typename bv> class r<bm<bj<bd, bv>>> : public bm<bj<bd, bv>>::bn {}; class s : public bm<bj<2, double>> { class t { public: t(bm *, int); void bc(D *p1) { bi a; bp<D>(a, *p1); } }; public: template <typename ay, typename az> s(ay p1, az q) : bm(p1, q) {} int cb; virtual int c() { p<t>(this, cb); } }; template <typename> class H { r<bm<bj<2, double>>> cf; virtual s cg() { s(0, cf); } }; template <template <class> class ci> class I { public: I() { ci<int>(); } }; class u { public: template <class> class n : I<H> {}; }; void v() { o<u> k; } int main() { return 0; } Steps to Repro: ----------------- g++ -O0 testcase.cpp testcase.cpp: In constructor ‘bm< <template-parameter-1-1> >::bp<bo>::bp(bm< <template-parameter-1-1> >::bi, bo) [with bo = D; <template-parameter-1-1> = bj<2, double>]’: testcase.cpp:38:31: internal compiler error: in assign_temp, at function.c:968 bp(bi, bo q) : bq(q.av - 0) {} ^ Compiler used: ----------------- The one included in Fedora 26 gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)