This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc 4.8 const vector<const string>


On 5 April 2013 10:22, Wood, Tobias wrote:
>
> 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 is invalid because it instantiates std::allocator<const
string>and the C++11 Allocator requirements state that the template
argument for an allocator is "any non-const object type."

> 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?

Don't.

I plan to add static assertions to std::allocator to improve the error
messages you get (see http://gcc.gnu.org/PR55963) but it still won't
compile.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]