New issue
Advanced search Search tips

Issue 789730 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

clang-cl fails to compile <vector> with custom allocator in debug

Project Member Reported by veranika@chromium.org, Nov 29 2017

Issue description

The minimal program on which the compilation fails:

#include <vector>
template<typename T>
  class fuzzer_allocator: public std::allocator<T> {
    public:
      template<class Other>
      struct rebind { typedef fuzzer_allocator<Other> other;  };
  };
int some_func() {
  std::vector<int, fuzzer_allocator<int>> v;
  return v.size();
}

Compiling this code with default values succeeds (i.e. clang-cl.exe repro.cc), but fails in the debug mode (i.e. clang-cl.exe /MDd repro.cc)

In file included from .\repro.cc:2:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\include\vector(555,12):  error: no matching constructor for initialization of 'std::_Vector_alloc<std::_Vec_base_types<int,
      (anonymous namespace)::fuzzer_allocator<int> > >::_Alproxy' (aka '(anonymous namespace)::fuzzer_allocator<std::_Container_proxy>')
                _Alproxy _Proxy_allocator(_Getal());
                         ^                ~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\include\vector(506,3):  note: in instantiation of member function 'std::_Vector_alloc<std::_Vec_base_types<int,
      (anonymous namespace)::fuzzer_allocator<int> > >::_Free_proxy' requested here
                _Free_proxy();
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\include\vector(683,2):  note: in instantiation of member function 'std::_Vector_alloc<std::_Vec_base_types<int,
      (anonymous namespace)::fuzzer_allocator<int> > >::~_Vector_alloc' requested here
        vector() _NOEXCEPT_COND(is_nothrow_default_constructible<_Alty>::value)
        ^
.\repro.cc(15,43):  note: in instantiation of member function 'std::vector<int, (anonymous namespace)::fuzzer_allocator<int> >::vector' requested here
  std::vector<int, fuzzer_allocator<int>> v;
                                          ^
.\repro.cc(7,9):  note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'fuzzer_allocator<int>' to 'const fuzzer_allocator<std::_Container_proxy>' for 1st argument
  class fuzzer_allocator: public std::allocator<T> {
        ^
.\repro.cc(7,9):  note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'fuzzer_allocator<int>' to 'fuzzer_allocator<std::_Container_proxy>' for 1st argument
.\repro.cc(7,9):  note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
 
Components: Build

Sign in to add a comment