Hello list, First a big thanks to the gcc contributors for releasing version 4.8. I've been waiting for it for a while now. I have managed to get my main project compiling, but only by removing the const qualifiers when doing the following: const vector<const string> c_string_vector { "A", "B", "C" }; This compiles fine with clang, but gcc produces an error message that I can't understand. I have attached a minimal test case and the output of g++ 4.8 on my system. Does anyone have any suggestions as to how to initialise this vector correctly? Just for people's information, there are several of these vectors that are the values of a map, and they have different lengths hence I can't use a const array<const string>, which does compile fine with g++ 4.8. Thanks in advance, Toby Wood
Attachment:
const_string_test.cpp
Description: const_string_test.cpp
In file included from /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/x86_64-unknown-linux-gnu/bits/c++allocator.h:33:0, from /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/bits/allocator.h:46, from /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/vector:61, from const_string_test.cpp:1: /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/ext/new_allocator.h: In instantiation of â??struct __gnu_cxx::new_allocator<const std::basic_string<char> >â??: /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/bits/allocator.h:92:11: required from â??class std::allocator<const std::basic_string<char> >â?? /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/bits/alloc_traits.h:90:43: required from â??struct std::allocator_traits<std::allocator<const std::basic_string<char> > >â?? /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/ext/alloc_traits.h:121:10: required from â??struct __gnu_cxx::__alloc_traits<std::allocator<const std::basic_string<char> > >â?? /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/bits/stl_vector.h:75:28: required from â??struct std::_Vector_base<const std::basic_string<char>, std::allocator<const std::basic_string<char> > >â?? /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/bits/stl_vector.h:210:11: required from â??class std::vector<const std::basic_string<char> >â?? const_string_test.cpp:9:29: required from here /cns_zfs/system/system_ce51_64/gcc/gcc-4.8.0/include/c++/4.8.0/ext/new_allocator.h:93:7: error: â??const _Tp* __gnu_cxx::new_allocator<_Tp>::address(__gnu_cxx::new_allocator<_Tp>::const_reference) const [with _Tp = const std::basic_string<char>; __gnu_cxx::new_allocator<_Tp>::const_pointer = const std::basic_string<char>*; __gnu_cxx::new_allocator<_Tp>::const_reference = const std::basic_string<char>&]â?? cannot be overloaded address(const_reference __x) const _GLIBCXX_NOEXCEPT ^ compilation terminated due to -Wfatal-errors.