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

--- Comment #2 from Sergey <dev at hrookami dot icu> ---
(In reply to Jonathan Wakely from comment #1)
> This is not a bug in std::variant:
> 
> 
> template<bool B>
> struct bool_constant
> {
>   static constexpr bool value = B;
>   using type = bool_constant;
> };
> 
> using true_type = bool_constant<true>;
> 
> template<typename T>
> struct is_default_constructible
> : bool_constant<__is_constructible(T)>
> { };
> 
> void testVarStruct()
> {
>     struct DataWithStruct {
>         struct A {
>             int number = 5; // compiles, if remove initialization
>         };
> 
>         is_default_constructible<A>::type t = true_type{};
>     };
> }
> 
> v.C: In function 'void testVarStruct()':
> v.C:22:47: error: could not convert 'true_type{}' from 'bool_constant<true>'
> to 'bool_constant<false>'
>    22 |         is_default_constructible<A>::type t = true_type{};
>       |                                               ^~~~~~~~~~~
>       |                                               |
>       |                                               bool_constant<true>
> 
> 
> This stopped working with r269032 which changed the result of the
> __is_constructible built-in.
> 
> Clang also rejects this, for the same reason, but EDG accepts it.

Clang compiles it if use libc++ instead of libstdc++

Reply via email to