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

            Bug ID: 92582
           Summary: [10 Regression] internal compiler error: Segmentation
                    fault with concept on constructor
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de
  Target Milestone: ---

Hi gcc-team,

the following code ices:

```
#include <functional>
template <typename I>
concept bool input_or_output_iterator = std::is_same_v<I &, decltype(++I{})>;
template <class From, class To> concept convertible_to = requires(From(f)()) {
  static_cast<To>(f());
};
template <typename> struct reference;
template <typename t> using reference_t = typename reference<t>::type;
template <input_or_output_iterator it_t> struct reference<it_t> {
  using type = typename std::iterator_traits<it_t>::reference;
};
template <typename rng_t>
requires (!input_or_output_iterator<rng_t>) struct reference<rng_t> {
  using type = reference_t<decltype(begin(std::declval<rng_t &>()))>;
};
template <typename> struct b {
  template <typename f>
  static constexpr bool e = convertible_to<reference_t<f>, int>;
  template <typename f> b(std::initializer_list<f>) requires e<f>;
};
b<void> g{std::vector<int>{}};
```

> g++-git -std=c++17 -fconcepts -c ice.cpp

as well as 

> g++-git -std=c++2a -c ice.cpp 

results in

```
ice.cpp:19:62: internal compiler error: Segmentation fault
   19 |   template <typename f> b(std::initializer_list<f>) requires e<f>;
      |                                                              ^~~~
0xc4999f crash_signal
        /home/marehr/Packages/gcc-git/src/gcc/gcc/toplev.c:328
0x72e6b5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:18836
0x735eb6 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:18765
0x735eb6 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:18423
0x65d8e2 satisfy_constraint_r
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2474
0x65e118 satisfy_constraint
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2554
0x65f4cb satisfy_associated_constraints
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2572
0x65f4cb constraints_satisfied_p
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2656
0x627852 add_function_candidate
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:2264
0x629e3c add_template_candidate_real
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:3422
0x62a3c6 add_template_candidate
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:3463
0x62a3c6 add_candidates
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:5781
0x62a6f4 add_candidates
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:5696
0x62a6f4 add_list_candidates
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:3902
0x63281e build_new_method_call_1
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:10086
0x6330d6 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:10268
0x6330d6 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:9706
0x6abb43 expand_default_init
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/init.c:1970
0x6abb43 expand_aggr_init_1
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/init.c:2085
0x6adab6 build_aggr_init(tree_node*, tree_node*, int, int)
        /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/init.c:1820
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
```

```
> g++-git -v
Using built-in specs.
COLLECT_GCC=g++-git
COLLECT_LTO_WRAPPER=/opt/gcc/gcc-git/bin/../lib/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/marehr/Packages/gcc-git/src/gcc/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++ --enable-shared --enable-threads=posix
--with-system-zlib --with-isl --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib
--disable-werror --enable-checking=release --enable-default-pie
--enable-default-ssp --enable-cet=auto --disable-boostrap
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.0 20191116 (experimental) (GCC)
```

Thank you!

Reply via email to