[Bug libstdc++/87809] New: Can't create empty std::optional<std::vector<int, CustomAlloc>>
ostash at ostash dot kiev.ua
gcc-bugzilla@gcc.gnu.org
Tue Oct 30 11:53:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87809
Bug ID: 87809
Summary: Can't create empty std::optional<std::vector<int,
CustomAlloc>>
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: ostash at ostash dot kiev.ua
Target Milestone: ---
Hello,
Following code snippet:
#include <optional>
#include <vector>
class Storage;
template <typename T>
class MyAlloc
{
public:
using value_type = T;
value_type* allocate(size_t n);
void deallocate(value_type* p, size_t n);
MyAlloc(Storage& storage) noexcept;
};
void test()
{
std::optional<std::vector<int, MyAlloc<int>>> opt;
}
compiles with GCC8, but fails with GCC9 trunk:
In file included from
/opt/compiler-explorer/gcc-trunk-20181028/include/c++/9.0.0/utility:68,
from
/opt/compiler-explorer/gcc-trunk-20181028/include/c++/9.0.0/optional:36,
from <source>:1:
/opt/compiler-explorer/gcc-trunk-20181028/include/c++/9.0.0/bits/stl_vector.h:
In instantiation of 'std::_Vector_base<_Tp,
_Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = MyAlloc<int>]':
/opt/compiler-explorer/gcc-trunk-20181028/include/c++/9.0.0/type_traits:925:12:
required from 'struct std::is_constructible<std::vector<int, MyAlloc<int> >
>'
/opt/compiler-explorer/gcc-trunk-20181028/include/c++/9.0.0/type_traits:2881:25:
required from 'constexpr const bool std::is_constructible_v<std::vector<int,
MyAlloc<int> > >'
/opt/compiler-explorer/gcc-trunk-20181028/include/c++/9.0.0/optional:715:66:
required by substitution of 'template<class ... _Args, typename
std::enable_if<is_constructible_v<std::vector<int, MyAlloc<int> >, _Args&&
...>, bool>::type <anonymous> > constexpr std::_Optional_base<std::vector<int,
MyAlloc<int> >, false, false>::_Optional_base(std::in_place_t, _Args&& ...)
[with _Args = {}; typename std::enable_if<is_constructible_v<std::vector<int,
MyAlloc<int> >, _Args&& ...>, bool>::type <anonymous> = <missing>]'
<source>:20:50: required from here
/opt/compiler-explorer/gcc-trunk-20181028/include/c++/9.0.0/bits/stl_vector.h:128:17:
error: no matching function for call to 'MyAlloc<int>::MyAlloc()'
128 | _Vector_impl() _GLIBCXX_NOEXCEPT_IF( noexcept(_Tp_alloc_type()) )
| ^~~~~~~~~~~~~~~~~~~~
<source>:15:3: note: candidate: 'MyAlloc<T>::MyAlloc(Storage&) [with T = int]'
15 | MyAlloc(Storage& storage) noexcept;
| ^~~~~~~
<source>:15:3: note: candidate expects 1 argument, 0 provided
<source>:7:7: note: candidate: 'constexpr MyAlloc<int>::MyAlloc(const
MyAlloc<int>&)'
7 | class MyAlloc
| ^~~~~~~
<source>:7:7: note: candidate expects 1 argument, 0 provided
<source>:7:7: note: candidate: 'constexpr
MyAlloc<int>::MyAlloc(MyAlloc<int>&&)'
<source>:7:7: note: candidate expects 1 argument, 0 provided
Compiler returned: 1
More information about the Gcc-bugs
mailing list