public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/91484] Error message: std::is_constructible with incomplete types.
       [not found] <bug-91484-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-11 18:22 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: redi at gcc dot gnu.org @ 2020-03-11 18:22 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-11 18:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-91484-4@http.gcc.gnu.org/bugzilla/>
2020-03-11 18:22 ` [Bug c++/91484] Error message: std::is_constructible with incomplete types redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).