https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83125
--- Comment #4 from Dmitry G. Dyachenko <dimhen at gmail dot com> --- one more test w/o -fpic and with less aggressive inlining $ /usr/local/gcc_current/bin/g++ -Wall -Wextra -O2 --param early-inlining-insns=18 --param max-early-inliner-iterations=10 -c -fpreprocessed x.ii during IPA pass: inline x.ii:11:44: internal compiler error: in edge_badness, at ipa-inline.c:993 n::aw o::bd() { m c; return (n::aw)0; } ^ 0x9c30ef edge_badness /home/dimhen/src/gcc_current/gcc/ipa-inline.c:992 0x18ee269 update_edge_key /home/dimhen/src/gcc_current/gcc/ipa-inline.c:1191 0x18ee7a8 update_caller_keys /home/dimhen/src/gcc_current/gcc/ipa-inline.c:1313 0x18ee6eb update_caller_keys /home/dimhen/src/gcc_current/gcc/ipa-inline.c:1302 0x18f030e inline_small_functions /home/dimhen/src/gcc_current/gcc/ipa-inline.c:2013 0x18f119f ipa_inline /home/dimhen/src/gcc_current/gcc/ipa-inline.c:2402 0x18f119f execute /home/dimhen/src/gcc_current/gcc/ipa-inline.c:2809 Please submit a full bug report, $ cat x.ii template < typename b > struct d { void aa(b *e) { e->~b(); } }; template < typename b > struct g : d< b > { template < typename f > g(f); }; struct k { static void ae(g< int >, int); }; template < typename ac = g< int > > struct ah { ac aj(); void ak() { aj().aa(0); k::ae(0, 0); } int *am; void an(int *); ~ah() { int h; an(&h); } }; template < typename ac > void ah< ac >::an(int *e) { int *i; while (e) { i = am; int *j = i; an(j); } int a; ak(); e = &a; } struct l; struct m { ah< g< l > > a; }; struct l { ah<> b; }; struct n { enum aw {}; }; struct o { n::aw bd(); }; n::aw o::bd() { m c; return (n::aw)0; } $ /usr/local/gcc_current/bin/g++ -v Using built-in specs. COLLECT_GCC=/usr/local/gcc_current/bin/g++ COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none Target: x86_64-pc-linux-gnu Configured with: /home/dimhen/src/gcc_current/configure --prefix=/usr/local/gcc_current --enable-checking=yes,df,fold,rtl,extra --enable-languages=c,c++,lto --disable-multilib --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --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=native Thread model: posix gcc version 8.0.0 20171203 (experimental) [trunk revision 255364] (GCC)