https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95233
Bug ID: 95233
Summary: Failure to compile regression in GCC 10.1 and 11 trunk
with C++ 20
Product: gcc
Version: c++-concepts
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: s_gccbugzilla at nedprod dot com
Target Milestone: ---
Reported originally at https://github.com/ned14/outcome/issues/225
Works on GCC 9.3 with -std=c++2a -O3 -DNDEBUG -fconcepts:
https://godbolt.org/z/cRyrj-
Works on GCC trunk with -std=c++17 -O3 -DNDEBUG -fconcepts:
https://godbolt.org/z/T3c88K
Works on clang trunk with -std=c++20 -O3 -DNDEBUG:
https://godbolt.org/z/ahbRsA
Fails on GCC trunk with -std=c++20 -O3 -DNDEBUG:
https://godbolt.org/z/NBdpqx
(It also fails with the same error on GCC 10.1. The cause is switching into C++
20, or using a GCC newer than 9.3 which works fine in C++ 20. GCC 10 and trunk
work fine in C++ 17 with Concepts forced on)
In file included from
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/bits/move.h:57,
from
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/bits/nested_exception.h:40,
from
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/exception:148,
from
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/new:41,
from
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:1008,
from <source>:1:
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits: In
instantiation of 'constexpr outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::basic_result(T&&, outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::value_converting_constructor_tag) [with T = const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&; R = std::filesystem::__cxx11::path; S =
std::error_code; NoValuePolicy =
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void>]':
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:901:30:
required from 'struct
std::__is_constructible_impl<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >, const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:906:12:
required from 'struct
std::is_constructible<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >, const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:3105:38:
required from 'constexpr const bool
std::is_constructible_v<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >, const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/concepts:139:30:
required from 'struct
std::iterator_traits<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> > >'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/bits/fs_path.h:88:11:
required by substitution of 'template<class _Iter, class _Iter_traits> using
__is_path_iter_src = std::__and_<std::__or_<std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, char>,
std::is_same<typename std::remove_const<typename
_Iter_traits::value_type>::type, char8_t>, std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, wchar_t>,
std::is_same<typename std::remove_const<typename
_Iter_traits::value_type>::type, char16_t>, std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, char32_t> >,
std::is_base_of<std::input_iterator_tag, typename
_Iter_traits::iterator_category> > [with _Iter =
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >; _Iter_traits =
std::iterator_traits<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> > >]'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/bits/fs_path.h:95:5:
[ skipping 13 instantiation contexts, use -ftemplate-backtrace-limit=0 to
disable ]
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:4248:3:
required from 'constexpr outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::basic_result(T&&, outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::value_converting_constructor_tag) [with T = const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&; R = std::filesystem::__cxx11::path; S =
std::error_code; NoValuePolicy =
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void>]'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:1239:4:
required from 'struct
std::__is_trivially_copy_constructible_impl<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >, true>'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:1244:12:
required from 'struct
std::is_trivially_copy_constructible<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> > >'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:3131:43:
required from 'constexpr const bool
std::is_trivially_copy_constructible_v<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> > >'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/optional:659:11:
required from 'class
std::optional<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> > >'
<source>:10:57: required from here
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:4249:13:
required by the constraints of 'template<class R, class S, class NoValuePolicy>
template<class T> requires outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::predicate<R, S,
NoValuePolicy>::enable_value_converting_constructor<T> constexpr
outcome_v2_cdb9621d::basic_result<R, S, NoValuePolicy>::basic_result(T&&,
outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::value_converting_constructor_tag)'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:901:30:
error: the value of
'outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >::predicate::enable_value_converting_constructor<const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>' is not usable in a constant expression
901 | : public __bool_constant<__is_constructible(_Tp, _Args...)>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from <source>:1:
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:4155:27: note:
'outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >::predicate::enable_value_converting_constructor<const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>' used in its own initializer
4155 | static constexpr bool enable_value_converting_constructor = //
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp: In instantiation
of 'constexpr const bool
outcome_v2_cdb9621d::detail::result_predicates<std::filesystem::__cxx11::path,
std::error_code>::enable_error_converting_constructor<const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>':
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:4164:23:
required from 'constexpr const bool
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >::predicate::enable_error_converting_constructor<const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>'
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:4260:3:
required from 'constexpr outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::basic_result(T&&, outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::error_converting_constructor_tag) [with T = const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&; R = std::filesystem::__cxx11::path; S =
std::error_code; NoValuePolicy =
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void>]'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:901:30:
required from 'struct
std::__is_constructible_impl<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >, const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:906:12:
required from 'struct
std::is_constructible<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >, const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:3105:38:
required from 'constexpr const bool
std::is_constructible_v<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >, const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/concepts:139:30:
[ skipping 15 instantiation contexts, use -ftemplate-backtrace-limit=0 to
disable ]
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:4248:3:
required from 'constexpr outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::basic_result(T&&, outcome_v2_cdb9621d::basic_result<R, S,
NoValuePolicy>::value_converting_constructor_tag) [with T = const
outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&; R = std::filesystem::__cxx11::path; S =
std::error_code; NoValuePolicy =
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void>]'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:1239:4:
required from 'struct
std::__is_trivially_copy_constructible_impl<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >, true>'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:1244:12:
required from 'struct
std::is_trivially_copy_constructible<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> > >'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/type_traits:3131:43:
required from 'constexpr const bool
std::is_trivially_copy_constructible_v<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> > >'
/opt/compiler-explorer/gcc-trunk-20200512/include/c++/11.0.0/optional:659:11:
required from 'class
std::optional<outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> > >'
<source>:10:57: required from here
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:3970:19: error:
the value of
'outcome_v2_cdb9621d::detail::is_implicitly_constructible<std::filesystem::__cxx11::path,
const outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>' is not usable in a constant expression
3970 | && ((!detail::is_implicitly_constructible<value_type, T> &&
detail::is_implicitly_constructible<error_type, T>) // is unambiguously for
error type
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from <source>:1:
/opt/compiler-explorer/libs/outcome/single-header/outcome.hpp:1129:53: note:
'outcome_v2_cdb9621d::detail::is_implicitly_constructible<std::filesystem::__cxx11::path,
const outcome_v2_cdb9621d::basic_result<std::filesystem::__cxx11::path,
std::error_code,
outcome_v2_cdb9621d::policy::error_code_throw_as_system_error<std::filesystem::__cxx11::path,
std::error_code, void> >&>' used in its own initializer
1129 | template <class T, class U> static constexpr bool
is_implicitly_constructible = _is_implicitly_constructible<T, U>::value;
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiler returned: 1