This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 4.8 const vector<const string>
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: "Wood, Tobias" <tobias dot wood at kcl dot ac dot uk>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Fri, 5 Apr 2013 10:54:38 +0100
- Subject: Re: gcc 4.8 const vector<const string>
- References: <543A2CEF-F948-419E-81E3-C700FDF30675 at kcl dot ac dot uk>
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.