public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "f.heckenbach@fh-soft.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61122] New: too many initializers
Date: Fri, 09 May 2014 04:32:00 -0000	[thread overview]
Message-ID: <bug-61122-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2014-05-09  4:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09  4:32 f.heckenbach@fh-soft.de [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-61122-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).