https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107033
Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Known to fail| |11.3.0, 12.2.0
--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Simplified. GCC12 only accepts when the span is an lvalue, and otherwise is
rejects-valid. GCC11 and GCC13 are ice-on-valid-code with different backtraces.
GCC11: https://godbolt.org/z/ev5Wb4d3v
GCC12: https://godbolt.org/z/bo6f5nT7Y
GCC13: https://godbolt.org/z/qGdWq4383
GCC12 lvalue: https://godbolt.org/z/zoz69ener
GCC11:
```
In file included from /app/std.hpp:2,
of module /app/std.hpp, imported at /app/mod.cpp:2:
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/span: In instantiation of
'class std::span<int>':
mod.cpp:3:51: required from here
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/span:155:9: internal
compiler error: Segmentation fault
155 | span(_It __first, size_type __count)
| ^~~~
0x17888c9 internal_error(char const*, ...)
???:0
0x7da897 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x7f6feb instantiate_class_template(tree_node*)
???:0
0x82a7f3 complete_type(tree_node*)
???:0
0x806c31 finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
???:0
0x7c123b c_parse_file()
???:0
0x894042 c_common_parse_file()
???:0
```
GCC12:
```
mod.cpp:3:35: error: no match for call to '(const
std::ranges::__cust_access::_Begin) (std::span<int>)'
3 | export auto _ = std::ranges::begin(std::span<int>{});
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/string_view:50,
from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/basic_string.h:47,
from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/string:53,
from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/locale_classes.h:40,
from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ios_base.h:41,
from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/streambuf:41,
from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/streambuf_iterator.h:35,
from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/iterator:66,
from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/ranges:43,
from /app/std.hpp:1,
of module /app/std.hpp, imported at /app/mod.cpp:2:
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:114:9:
note: candidate: 'template<class _Tp> requires (__maybe_borrowed_range<_Tp>)
&& ((is_array_v<typename std::remove_reference<_Tp>::type>) ||
(__member_begin<_Tp>) || (__adl_begin<_Tp>)) constexpr auto
std::ranges::__cust_access::_Begin::operator()(_Tp&&) const'
114 | operator()[[nodiscard]](_Tp&& __t) const
noexcept(_S_noexcept<_Tp&>())
| ^~~~~~~~
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:114:9:
note: template argument deduction/substitution failed:
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:114:9:
note: constraints not satisfied
mod.cpp: In substitution of 'template<class _Tp> requires
(__maybe_borrowed_range<_Tp>) && ((is_array_v<typename
std::remove_reference<_Tp>::type>) || (__member_begin<_Tp>) ||
(__adl_begin<_Tp>)) constexpr auto
std::ranges::__cust_access::_Begin::operator()(_Tp&&) const [with _Tp =
std::span<int>]':
mod.cpp:3:35: required from here
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:83:15:
required for the satisfaction of '__maybe_borrowed_range<_Tp>' [with _Tp =
std::span<int, 18446744073709551615>]
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:85:11:
note: no operand of the disjunction is satisfied
84 | = is_lvalue_reference_v<_Tp>
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
85 | || enable_borrowed_range<remove_cvref_t<_Tp>>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: set '-fconcepts-diagnostics-depth=' to at least 2 for more
detail
mod.cpp:1:8: warning: not writing module 'mod' due to errors
1 | export module mod;
| ^~~~~~
```
GCC13:
```
mod.cpp:1:8: internal compiler error: Segmentation fault
1 | export module mod;
| ^~~~~~
0x234bd6e internal_error(char const*, ...)
???:0
0xc84cfe walk_specializations(bool, void (*)(bool, spec_entry*, void*), void*)
???:0
0xbead4c depset::hash::add_specializations(bool)
???:0
0xbfb5a8 module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
???:0
0xbfcd45 finish_module_processing(cpp_reader*)
???:0
0xb89d2e c_parse_final_cleanups()
???:0
0xdb0cc8 c_common_parse_file()
???:0
```