http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61122
Bug ID: 61122
Summary: too many initializers
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
g++ says "too many initializers" for an array of vectors with initializers, but
only within a struct.
Not sure if it should work (I don't see why not), but it seems inconsistent
that it only fails within a struct. Also, the error message is misleading ("too
many initializers" even for an empty brace-list).
#include <vector>
std::vector <int> a1[] { { } };
std::vector <int> a2[] { { 1, 2, 3 } };
std::vector <int> a3[] { std::vector <int> () };
std::vector <int> a4[] { std::vector <int> (1) };
struct s
{
std::vector <int> b1[] { { } };
std::vector <int> b2[] { { 1, 2, 3 } };
std::vector <int> b3[] { std::vector <int> () };
std::vector <int> b4[] { std::vector <int> (1) };
};
% g++ -std=c++11 test.cpp
test.cpp:10:32: error: too many initializers for 'std::vector<int> [0]'
test.cpp:11:40: error: too many initializers for 'std::vector<int> [0]'
test.cpp:12:49: error: too many initializers for 'std::vector<int> [0]'
test.cpp:13:50: error: too many initializers for 'std::vector<int> [0]'