https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121893
Bug ID: 121893 Summary: [Modules] ICE when using modules + ranges. regression in gcc 16.0 Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: shyeyian at petalmail dot com Target Milestone: --- ===== main.cpp ===== import std; auto func(const std::string& str) { return str | std::views::reverse; } int main ( ) { } ===== version ===== g++ (GCC) 16.0.0 20250910 (experimental) git = 06628704c611b1a7f788e64b306338c653ad074d ===== command ===== [anonymous@matebook test-gcc]$ /opt/gcc/bin/g++ -std=c++23 -fmodules -c /opt/gcc/include/c++/16.0.0/bits/std.cc -o std.o [anonymous@matebook test-gcc]$ /opt/gcc/bin/g++ -std=c++23 -fmodules main.cpp -o main In file included from /opt/gcc/include/c++/16.0.0/compare:43, from /opt/gcc/include/c++/16.0.0/bits/stl_pair.h:65, from /opt/gcc/include/c++/16.0.0/bits/stl_algobase.h:64, from /opt/gcc/include/c++/16.0.0/algorithm:62, from /opt/gcc/include/c++/16.0.0/x86_64-pc-linux-gnu/bits/stdc++.h:53, from /opt/gcc/include/c++/16.0.0/bits/std.cc:30, of module std, imported at main.cpp:1: /opt/gcc/include/c++/16.0.0/concepts: In substitution of 'template<class _Tp, class _Up> requires (__adl_swap<_Tp, _Up>) || (same_as<_Tp, _Up>) && (is_lvalue_reference_v<_Tp>) && (move_constructible<typename std::remove_reference<_Tp>::type>) && (assignable_from<_Tp, typename std::remove_reference<_Tp>::type>) constexpr void std::ranges::__swap::_Swap::operator()(_Tp&&, _Up&&) const [with _Tp = std::ranges::ref_view<const std::__cxx11::basic_string<char> >&; _Up = std::ranges::ref_view<const std::__cxx11::basic_string<char> >&]': required by substitution of 'template<class _Vp> requires (view<_Vp>) && (bidirectional_range<_Vp>) class std::ranges::reverse_view [with _Vp = std::ranges::ref_view<const std::__cxx11::basic_string<char> >]' /opt/gcc/include/c++/16.0.0/concepts:259:52: 259 | = requires(_Tp& __a, _Tp& __b) { ranges::swap(__a, __b); }; | ~~~~~~~~~~~~^~~~~~~~~~ required by substitution of 'template<class _Range> std::ranges::reverse_view(_Range&&) -> reverse_view<views::all_t<_Range> > [with _Range = const std::__cxx11::basic_string<char>&]' /opt/gcc/include/c++/16.0.0/ranges:4103:5: 4103 | reverse_view(_Range&&) -> reverse_view<views::all_t<_Range>>; | ^~~~~~~~~~~~ required by substitution of 'template<class _Range> requires (viewable_range<_Range>) && ((__is_reverse_view<typename std::remove_cvref<_Tp>::type>) || (__is_reversible_subrange<typename std::remove_cvref<_Tp>::type>) || (__can_reverse_view<_Range>)) constexpr auto std::ranges::views::_Reverse::operator()(_Range&&) const [with _Range = const std::__cxx11::basic_string<char>&]' /opt/gcc/include/c++/16.0.0/ranges:4130:17: 4130 | = requires { reverse_view{std::declval<_Range>()}; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ required by substitution of 'template<class _Self, class _Range> requires (__is_range_adaptor_closure<_Self>) && (__adaptor_invocable<_Self, _Range>) constexpr auto std::ranges::views::__adaptor::operator|(_Range&&, _Self&&) [with _Self = const std::ranges::views::_Reverse&; _Range = const std::__cxx11::basic_string<char>&]' /opt/gcc/include/c++/16.0.0/ranges:934:44: 934 | = requires { std::declval<_Adaptor>()(declval<_Args>()...); }; | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ required from here main.cpp:4:30: 4 | return str | std::views::reverse; | ^~~~~~~ /opt/gcc/include/c++/16.0.0/concepts:200:17: internal compiler error: tree check: expected function_decl, have using_decl in add_candidates, at cp/call.cc:6761 200 | swap(static_cast<_Tp&&>(__t), static_cast<_Up&&>(__u)); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0x28e1a37 internal_error(char const*, ...) ../../git/gcc/diagnostic-global-context.cc:786 0x9a3707 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../git/gcc/tree.cc:9188 0x77c22c tree_check(tree_node*, char const*, int, char const*, tree_code) ../../git/gcc/tree.h:3733 0x77c22c add_candidates ../../git/gcc/cp/call.cc:6761 0xabc280 add_candidates ../../git/gcc/cp/call.cc:5157 0xabc280 perform_overload_resolution ../../git/gcc/cp/call.cc:5174 0xac25f1 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../git/gcc/cp/call.cc:5275 0xd5a64c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../git/gcc/cp/semantics.cc:3534 0xd0201e tsubst_expr(tree_node*, tree_node*, int, tree_node*) ../../git/gcc/cp/pt.cc:21960 0xb149c8 tsubst_valid_expression_requirement ../../git/gcc/cp/constraint.cc:1346 0xb1c5ef tsubst_simple_requirement ../../git/gcc/cp/constraint.cc:1383 0xb1c5ef tsubst_requirement ../../git/gcc/cp/constraint.cc:1598 0xb1c5ef tsubst_requires_expr ../../git/gcc/cp/constraint.cc:1738 0xb1ccda tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*) ../../git/gcc/cp/constraint.cc:1762 0xcffb2f tsubst_expr(tree_node*, tree_node*, int, tree_node*) ../../git/gcc/cp/pt.cc:22739 0xb1db7a satisfy_atom ../../git/gcc/cp/constraint.cc:2478 0xb1db7a satisfy_constraint_r ../../git/gcc/cp/constraint.cc:2544 0xb1d2b1 satisfy_disjunction ../../git/gcc/cp/constraint.cc:2297 0xb1d2b1 satisfy_constraint_r ../../git/gcc/cp/constraint.cc:2542 0xb1e1d1 satisfy_normalized_constraints ../../git/gcc/cp/constraint.cc:2569 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ===== additional ===== Above ICE in g++ 16.0, but works in g++ 15.2.