[Bug libstdc++/58764] New: error: converting to ‘const std?=::vector<std::basic string<char> >=?UTF-8?Q?’ from initializer list would use explicit constructor

markus at trippelsdorf dot de gcc-bugzilla@gcc.gnu.org
Thu Oct 17 08:04:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58764

            Bug ID: 58764
           Summary: error: converting to ‘const
                    std::vector<std::basic_string<char> >’ from
                    initializer list would use explicit constructor
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markus at trippelsdorf dot de

aria2 fails to compile with gcc-4.8:

download_helper.cc: In member function ‘void
aria2::{anonymous}::AccRequestGroup::operator()(const string&)’:
download_helper.cc:373:64: error: converting to ‘const
std::vector<std::basic_string<char> >’ from initializer list would use explicit
constructor ‘std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp
= std::basic_string<char>; _Alloc = std::allocator<std::basic_string<char> >;
std::vector<_Tp, _Alloc>::allocator_type =
std::allocator<std::basic_string<char> >]’
           (createBtRequestGroup(uri, option_, {}, torrent.get()));
                                                                ^

Reduced:

markus@x4 tmp % cat test.cpp
#include <vector>
#include <string>

void foo (const std::vector<std::string>& test)
{
}
void bar ()
{
  foo ({});
}

markus@x4 tmp % g++ -std=c++11 -c test.cpp
test.cpp: In function ‘void bar()’:
test.cpp:9:10: error: converting to ‘const std::vector<std::basic_string<char>
>’ from initializer list would use explicit constructor ‘std::vector<_Tp,
_Alloc>::vector(const allocator_type&) [with _Tp = std::basic_string<char>;
_Alloc = std::allocator<std::basic_string<char> >; std::vector<_Tp,
_Alloc>::allocator_type = std::allocator<std::basic_string<char> >]’
   foo ({});
          ^

markus@x4 tmp % /usr/x86_64-pc-linux-gnu/gcc-bin/4.8.1/g++ -std=c++11 -c
test.cpp
markus@x4 tmp % clang++ -stdlib=libc++ -std=c++11 -c test.cpp
markus@x4 tmp %


More information about the Gcc-bugs mailing list