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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.0
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The second example is:

#include <type_traits>

using std::is_constructible_v;

template<typename T>
struct basic_mixin
{
    basic_mixin(T);
};

template<typename Cur>
struct basic_iterator : basic_mixin<Cur>
{
    static_assert(is_constructible_v<basic_mixin<Cur>, Cur>);
};

template<typename Derived>
struct view_interface
{
    template<typename I = basic_iterator<Derived>,
             bool = is_constructible_v<I,I>>
    operator int() const;
};

struct iota_view : view_interface<iota_view>
{
};

using I = basic_iterator<iota_view>;
template struct basic_iterator<iota_view>;
static_assert(is_constructible_v<I,I>);

GCC 9 rejects it (the static assertion fails) but doesn't diagnose the UB for
an incomplete type (probably due to PR 92067).

GCC 10 diagnoses the UB:

In file included from 91484.cc:1:
/home/jwakely/gcc/10/include/c++/10.0.1/type_traits: In instantiation of
'struct std::is_constructible<basic_iterator<iota_view>,
basic_iterator<iota_view> >':
/home/jwakely/gcc/10/include/c++/10.0.1/type_traits:3107:25:   required from
'constexpr const bool std::is_constructible_v<basic_iterator<iota_view>,
basic_iterator<iota_view> >'
91484.cc:21:21:   required by substitution of 'template<class I, bool
<anonymous> > view_interface<iota_view>::operator int<I, <anonymous> >() const
[with I = basic_iterator<iota_view>; bool <anonymous> = <missing>]'
/home/jwakely/gcc/10/include/c++/10.0.1/type_traits:901:30:   required from
'struct std::__is_constructible_impl<basic_mixin<iota_view>, iota_view>'
/home/jwakely/gcc/10/include/c++/10.0.1/type_traits:906:12:   required from
'struct std::is_constructible<basic_mixin<iota_view>, iota_view>'
/home/jwakely/gcc/10/include/c++/10.0.1/type_traits:3107:25:   required from
'constexpr const bool std::is_constructible_v<basic_mixin<iota_view>,
iota_view>'
91484.cc:14:19:   required from 'struct basic_iterator<iota_view>'
91484.cc:30:17:   required from here
/home/jwakely/gcc/10/include/c++/10.0.1/type_traits:909:52: error: static
assertion failed: template argument must be a complete class or an unbounded
array
  909 |      
static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
      |                    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
91484.cc:31:15: error: static assertion failed
   31 | static_assert(is_constructible_v<I,I>);
      |               ^~~~~~~~~~~~~~~~~~~~~~~


So I think this is fixed.

Reply via email to