[Bug c++/104788] New: ICE

raffael at casagrande dot ch gcc-bugzilla@gcc.gnu.org
Fri Mar 4 16:24:36 GMT 2022


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

            Bug ID: 104788
           Summary: ICE
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raffael at casagrande dot ch
  Target Milestone: ---

The following simple program produces an internal compiler error when compiled
with "-std=c++20" (problem seems to be fixed in current trunk 12.0!):

#include <algorithm>
#include <vector>

template <class MESH_FACTORY>
class OpenFoamReader {
 public:
  OpenFoamReader() {
    auto z = []() {
      struct Connection {
        std::uint32_t end_point;
        auto operator<=>(const Connection&) const noexcept ->
std::strong_ordering = default;
      };
      std::vector<Connection> connections;

      // sort connections
      std::ranges::sort(connections);
    };
  }
};

int main() {
    OpenFoamReader<int> reader;
}

================================================
Error message:
================================================
In file included from
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/bits/move.h:57,
                 from
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/bits/stl_pair.h:59,
                 from
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/utility:70,
                 from
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/algorithm:60,
                 from <source>:1:
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/type_traits: In
instantiation of 'constexpr const bool std::is_invocable_v<std::ranges::less&,
OpenFoamReader<int>::OpenFoamReader()::<lambda()>::Connection&,
OpenFoamReader<int>::OpenFoamReader()::<lambda()>::Connection&>':
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/concepts:338:25:  
required by substitution of 'template<class _Range, class _Comp, class _Proj> 
requires (random_access_range<_Range>) &&
(sortable<decltype(std::ranges::__cust_access::__begin((declval<_Container&>)())),
_Comp, _Proj>) constexpr std::ranges::borrowed_iterator_t<_Range>
std::ranges::__sort_fn::operator()(_Range&&, _Comp, _Proj) const [with _Range =
std::vector<OpenFoamReader<int>::OpenFoamReader()::<lambda()>::Connection,
std::allocator<OpenFoamReader<int>::OpenFoamReader()::<lambda()>::Connection>
>&; _Comp = std::ranges::less; _Proj = std::identity]'
<source>:16:24:   required from 'OpenFoamReader<MESH_FACTORY>::OpenFoamReader()
[with MESH_FACTORY = int]'
<source>:22:25:   required from here
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/type_traits:3001:27:
internal compiler error: Segmentation fault
 3001 |     inline constexpr bool is_invocable_v = is_invocable<_Fn,
_Args...>::value;
      |                           ^~~~~~~~~~~~~~
0x1786229 internal_error(char const*, ...)
        ???:0
0x806d30 stmts_are_full_exprs_p()
        ???:0
0x700b81 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0x7e02f3 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x70a613 maybe_instantiate_decl(tree_node*)
        ???:0
0x7f4881 lookup_and_finish_template_variable(tree_node*, tree_node*, int)
        ???:0
0x6c532a constraints_satisfied_p(tree_node*, tree_node*)
        ???:0
0x7f7487 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0x695371 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
        ???:0
0x80ae32 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0x7f2e86 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7e02f3 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x7fb69b instantiate_pending_templates(int)
        ???:0
0x70cd4d c_parse_final_cleanups()
        ???:0


More information about the Gcc-bugs mailing list