https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98346

            Bug ID: 98346
           Summary: ICE with a combination of concepts, decltype and type
                    aliases
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drozdov_xf2g3gb3 at mail dot ru
  Target Milestone: ---

The following code(https://godbolt.org/z/asPv6s):

    template <class, class...>
    concept always_satisfied = true;

    using arg_alias = int;

    template <always_satisfied F>
    using result_of = decltype(F{}(arg_alias{}));

    template <class F>
    always_satisfied<result_of<F>> auto foo(F) {}

    void bar() { foo([](auto){}); }

When compiled with -v -std=c++20 produces:

Using built-in specs.
COLLECT_GCC=/opt/compiler-explorer/gcc-snapshot/bin/g++
COLLECT_LTO_WRAPPER=/opt/compiler-explorer/gcc-trunk-20201217/bin/../libexec/gcc/x86_64-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../gcc-trunk-20201217/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,d
--enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto
--enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201216 (experimental) (Compiler-Explorer-Build) 
COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-g' '-o' './output.s' '-L.'
'-v' '-std=c++20' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir'
'./output.s-'

/opt/compiler-explorer/gcc-trunk-20201217/bin/../libexec/gcc/x86_64-linux-gnu/11.0.0/cc1plus
-quiet -v -imultiarch x86_64-linux-gnu -iprefix
/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/x86_64-linux-gnu/11.0.0/
-D_GNU_SOURCE <source> -quiet -dumpdir ./output.s- -dumpbase example.cpp
-dumpbase-ext .cpp -mtune=generic -march=x86-64 -g -std=c++20 -version
-fdiagnostics-color=always -o /tmp/ccwWsVpH.s
GNU C++20 (Compiler-Explorer-Build) version 11.0.0 20201216 (experimental)
(x86_64-linux-gnu)
        compiled by GNU C version 7.5.0, GMP version 6.1.0, MPFR version 3.1.4,
MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/x86_64-linux-gnu/11.0.0/../../../../x86_64-linux-gnu/include"
ignoring duplicate directory
"/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0"
ignoring duplicate directory
"/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0/x86_64-linux-gnu"
ignoring duplicate directory
"/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0/backward"
ignoring duplicate directory
"/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11.0.0/include"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring duplicate directory
"/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11.0.0/include-fixed"
ignoring nonexistent directory
"/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11.0.0/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0

/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0/x86_64-linux-gnu

/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0/backward

/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/x86_64-linux-gnu/11.0.0/include

/opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/x86_64-linux-gnu/11.0.0/include-fixed
 /usr/local/include
 /opt/compiler-explorer/gcc-trunk-20201217/bin/../lib/gcc/../../include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++20 (Compiler-Explorer-Build) version 11.0.0 20201216 (experimental)
(x86_64-linux-gnu)
        compiled by GNU C version 7.5.0, GMP version 6.1.0, MPFR version 3.1.4,
MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: b4bad02868d3360f899970e9993fe4c2
<source>: In instantiation of 'auto [requires ::always_satisfied<<placeholder>,
decltype({}({}))>] foo(F) [with F = bar()::<lambda(auto:1)>]':
<source>:12:32:   required from here
<source>:10:49: internal compiler error: Segmentation fault
   10 |     always_satisfied<result_of<F>> auto foo(F) {}
      |                                                 ^
0x1c97449 internal_error(char const*, ...)
        ???:0
0x9772c3 finish_decltype_type(tree_node*, bool, int)
        ???:0
0x9ac5d8 strip_typedefs(tree_node*, bool*, unsigned int)
        ???:0
0x8ddf7e canonicalize_type_argument(tree_node*, int)
        ???:0
0x729bfa build_concept_check(tree_node*, tree_node*, tree_node*, int)
        ???:0
0x8f6c60 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ???:0
0x79f2e7 finish_function(bool)
        ???:0
0x90959f instantiate_decl(tree_node*, bool, bool)
        ???:0
0x7b6a3e maybe_instantiate_decl(tree_node*)
        ???:0
0x7b8100 mark_used(tree_node*, int)
        ???:0
0x6d1657 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x96cf4c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0x8cf015 c_parse_file()
        ???:0
0xa4ae82 c_common_parse_file()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to