public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "public at alisdairm dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/40308]  New: Brace initialization fails for member initializers in constructor for class templates
Date: Sat, 30 May 2009 14:47:00 -0000	[thread overview]
Message-ID: <bug-40308-17779@http.gcc.gnu.org/bugzilla/> (raw)

Tested against MinGW 4.4.0

The following code fails to compile, with the two specializations yielding
different error messages.

Test code:

template< typename T >
struct test {
   test() : data{} {}

   T data;
};

int main()
{
   test<int> x;
   test<int*> y;
   return 0;
}


Compiler output:
||=== BraceInitBug01, Debug ===|
main.cpp||In constructor 'test<T>::test() [with T = int]':|
main.cpp|10|instantiated from here|
main.cpp|3|error: aggregate value used where an integer was expected|
main.cpp||In constructor 'test<T>::test() [with T = int*]':|
main.cpp|11|instantiated from here|
main.cpp|3|error: cannot convert '<brace-enclosed initializer list>()' from
type '<brace-enclosed initializer list>' to type 'int*'|
||=== Build finished: 2 errors, 0 warnings ===|


-- 
           Summary: Brace initialization fails for member initializers in
                    constructor for class templates
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: public at alisdairm dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40308


             reply	other threads:[~2009-05-30 14:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-30 14:47 public at alisdairm dot net [this message]
2009-06-02 17:03 ` [Bug c++/40308] " jason at gcc dot gnu dot org
2009-06-02 20:14 ` jason at gcc dot gnu dot org
2009-06-03 18:12 ` jason at gcc dot gnu dot 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-40308-17779@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).