public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61122] New: too many initializers
@ 2014-05-09  4:32 f.heckenbach@fh-soft.de
  2014-05-09 10:41 ` [Bug c++/61122] "too many initializers" for NSDMI for array of unknown bound redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: f.heckenbach@fh-soft.de @ 2014-05-09  4:32 UTC (permalink / raw)
  To: gcc-bugs

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: f.heckenbach@fh-soft.de

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]'


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-09 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-09  4:32 [Bug c++/61122] New: too many initializers f.heckenbach@fh-soft.de
2014-05-09 10:41 ` [Bug c++/61122] "too many initializers" for NSDMI for array of unknown bound redi at gcc dot gnu.org
2014-05-09 10:45 ` f.heckenbach@fh-soft.de
2014-05-09 11:13 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).