[Bug libstdc++/88840] [9 Regression] std::allocator::construct signature might be ill-formed now

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 24 14:37:00 GMT 2019


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The following program no longer compiles with clang:

#include <vector>

struct Something
{
  std::vector<Something> member;
};

int main() {}


It produces the following error:

In file included from t.cpp:1:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/vector:60:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_algobase.h:64:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_pair.h:59:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/move.h:55:
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/type_traits:667:38:
error: incomplete type 'Something' used in type trait expression
    : public integral_constant<bool, __is_trivial(_Tp)>
                                     ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_uninitialized.h:901:7:
note: in instantiation of template class 'std::is_trivial<Something>' requested
here
    : is_trivial<_Tp> { };
      ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_uninitialized.h:904:31:
note: in instantiation of template class
'std::__is_trivially_relocatable<Something, void>' requested here
    inline __enable_if_t<std::__is_trivially_relocatable<_Tp>::value, _Tp*>
                              ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_uninitialized.h:940:23:
note: while substituting deduced template arguments into function template
'__relocate_a_1'
      [with _Tp = Something, _Up = Something]
    noexcept(noexcept(__relocate_a_1(std::__niter_base(__first),
                      ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_vector.h:428:11:
note: in instantiation of exception specification for
      '__relocate_a<Something *, Something *, std::allocator<Something> >'
requested here
        noexcept(std::__relocate_a(std::declval<pointer>(),
                 ^
t.cpp:5:26: note: in instantiation of template class 'std::vector<Something,
std::allocator<Something> >' requested here
  std::vector<Something> member;
                         ^
t.cpp:3:8: note: definition of 'Something' is not complete until the closing
'}'
struct Something
       ^

And two more similar errors. We need to support incomplete types, so we need to
delay the evaluation of __relocatable until it's needed.


More information about the Gcc-bugs mailing list