[Bug c++/93551] [10 Regression] Call from templated function to constrained constructor segfaults when attempting to narrow to bool
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 3 17:58:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93551
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-02-03
CC| |jakub at gcc dot gnu.org
Target Milestone|--- |10.0
Summary|Call from templated |[10 Regression] Call from
|function to constrained |templated function to
|constructor segfaults when |constrained constructor
|attempting to narrow to |segfaults when attempting
|bool |to narrow to bool
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started to ICE with r10-5012-g72479e324313e8a68a534527f79e741f9a7df6fa.
Testcase that doesn't need any includes:
namespace std {
template<typename _Tp, _Tp __v>
struct integral_constant
{
static constexpr _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant<_Tp, __v> type;
constexpr operator value_type() const noexcept { return value; }
};
template<typename _Base, typename _Derived>
struct is_base_of
: public integral_constant<bool, __is_base_of(_Base, _Derived)>
{ };
template <typename _Base, typename _Derived>
inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
}
class Bar { };
struct Foo {
template <typename P> requires std::is_base_of_v<Bar, P>
Foo(P const&);
};
template <typename P>
Foo fun(P const& arg) {
(bool)arg;
return Foo {arg};
}
int main() {
fun(Bar{});
return 0;
}
More information about the Gcc-bugs
mailing list