Created attachment 44780 [details] preprocessed code sample === compiler and system information === $ g++-8.2.0 -v Using built-in specs. COLLECT_GCC=g++-8.2.0 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/python --enable-languages=c,c++,go,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 8.2.0-r3 p1.4' --disable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --with-multilib-list=m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libmpx --disable-systemtap --enable-vtable-verify --enable-libvtv --enable-lto --without-isl --enable-libsanitizer --enable-default-pie --enable-default-ssp Thread model: posix gcc version 8.2.0 (Gentoo 8.2.0-r3 p1.4) === the complete command line that triggers the bug, the compiler output === $ g++-8.2.0 -std=c++14 -o /dev/null -c ice_sample_8.2.0.ii In file included from main.cc:2: crow/app.h: In instantiation of 'typename std::result_of<decltype (& crow::Router::new_rule_tagged<Tag>)(crow::Router, std::__cxx11::basic_string<char>&&)>::type crow::Crow<Middlewares>::route(std::__cxx11::string&&) [with long unsigned int Tag = 0; Middlewares = {}]': main.cc:8:1: required from here crow/app.h:63:14: internal compiler error: in write_expression, at cp/mangle.c:3050 auto route(std::string&& rule) ^~~~~ 0x59167a write_expression /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:3050 0x65a9af write_expression /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:3373 0x65876e write_type /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:2352 0x659d1d write_bare_function_type /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:2731 0x65d39b write_function_type /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:2706 0x658244 write_type /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:2214 0x65d58b write_template_args /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:2841 0x65d8da write_prefix /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:1146 0x6574ba write_nested_name /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:1076 0x658680 write_type /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:2232 0x659d1d write_bare_function_type /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:2731 0x65dcf4 mangle_decl_string /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:3795 0x65df28 get_mangled_id /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:3817 0x65df28 mangle_decl(tree_node*) /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cp/mangle.c:3855 0xdaaf99 decl_assembler_name(tree_node*) /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/tree.c:687 0x7e0fc5 symbol_table::insert_to_assembler_name_hash(symtab_node*, bool) /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/symtab.c:174 0x7e1924 symbol_table::symtab_initialize_asm_name_hash() /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/symtab.c:266 0x7e19b4 symbol_table::symtab_initialize_asm_name_hash() /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/symtab.c:976 0x7e19b4 symtab_node::get_for_asmname(tree_node const*) /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/symtab.c:964 0x7f1660 handle_alias_pairs /var/tmp/portage/sys-devel/gcc-8.2.0-r3/work/gcc-8.2.0/gcc/cgraphunit.c:1398 === an (older) working version of the compiler === $ g++-7.3.0 -v Using built-in specs. COLLECT_GCC=g++-7.3.0 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-7.3.0-r3/work/gcc-7.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/7.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/7.3.0/python --enable-languages=c,c++,go,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 7.3.0-r3 p1.4' --disable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --with-multilib-list=m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --enable-libmpx --enable-vtable-verify --enable-libvtv --enable-lto --without-isl --enable-libsanitizer --enable-default-pie --enable-default-ssp Thread model: posix gcc version 7.3.0 (Gentoo 7.3.0-r3 p1.4)
Confirmed, I'm reducing that..
Started with r251438. Can you please attach pre-processed source file created with GCC 7.3.x ?
Created attachment 44783 [details] preprocessed code sample (gcc-7.3.0)
Thanks!
(In reply to Martin Liška from comment #4) > Thanks! No problems. Let me know if I could do anything else.
(In reply to Alexander Sergeyev from comment #5) > (In reply to Martin Liška from comment #4) > > Thanks! > > No problems. Let me know if I could do anything else. Now all you need to do is to be patient and wait for a fix ;)
Reduced test-case: $ cat ice.ii template < int a > struct b { static constexpr int c = a; }; template < typename > struct d; template < typename > struct e; template < typename f, typename g > struct e< f g::* > : b< d< f >::c > {}; template < typename h, typename... i > struct d< h(i...) > : b< true > {}; template < typename > class j; struct k { typedef int l; }; template < bool, bool, typename... > struct m; template < typename ab, typename n, typename... o > struct m< false, true, ab, n, o... > : k {}; template < typename ac, typename... i > struct ad : m< b< false >::c, e< ac >::c, i... > {}; template < typename ac, typename... i > struct j< ac(i...) > : ad< ac, i... > {}; class p { public: p(char *); }; class q { public: template < long > void r(); }; class s { public: template < long t > auto ae(p) -> typename j< decltype (&q::r< t >)(q, p) >::l; }; using z = s; void f() { z ag; ag.ae< 0 >(""); }
Slightly adjusted testcase: template <int N> struct A { static constexpr int c = N; }; template <typename> struct B; template <typename> struct C; template <typename T, typename U> struct C<T U::*> : A<B<T>::c> {}; template <typename T, typename... U> struct B<T (U...)> : A<true> {}; template <typename> class D; struct E { typedef int l; }; template <bool, bool, typename...> struct F; template <typename T, typename U, typename... V> struct F<false, true, T, U, V...> : E {}; template <typename T, typename... U> struct G : F<A<false>::c, C<T>::c, U...> {}; template <typename T, typename... U> struct D<T (U...)> : G<T, U...> {}; struct H { H (const char *); }; struct I { template <long> void foo (); }; struct J { template <long t> auto bar (H) -> typename D<decltype (&I::foo<t>) (I, H)>::l; }; void foo () { J j; j.bar<0> (""); }
struct A { template <long> void foo (); }; template <long t> auto bar () -> decltype (&A::foo<t>); void foo () { bar<0> (); }
Author: jason Date: Wed Feb 20 18:59:18 2019 New Revision: 269048 URL: https://gcc.gnu.org/viewcvs?rev=269048&root=gcc&view=rev Log: PR c++/87513 - 'sorry' mangling PMF template-id. Here build_offset_ref calls build_qualified_name to make a SCOPE_REF because the dependent template arguments make type_dependent_expression_p (member) true. We could probably work hard to prevent this, but it doesn't seem necessary, and it's easy to fix write_expression to handle the result. * mangle.c (write_expression): Handle SCOPE_REF to BASELINK. Added: trunk/gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/mangle.c
Fixed on trunk so far.
GCC 8.3 has been released.
Author: jason Date: Fri Mar 8 18:21:02 2019 New Revision: 269502 URL: https://gcc.gnu.org/viewcvs?rev=269502&root=gcc&view=rev Log: PR c++/87513 - 'sorry' mangling PMF template-id. Here build_offset_ref calls build_qualified_name to make a SCOPE_REF because the dependent template arguments make type_dependent_expression_p (member) true. We could probably work hard to prevent this, but it doesn't seem necessary, and it's easy to fix write_expression to handle the result. * mangle.c (write_expression): Handle SCOPE_REF to BASELINK. Added: branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C Modified: branches/gcc-8-branch/gcc/cp/ChangeLog branches/gcc-8-branch/gcc/cp/mangle.c
Fixed for 8.4.