public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39901]  New: [C++0x] Initializer list not allowed in []
@ 2009-04-25 21:27 tom dot prince at ualberta dot net
  2009-04-25 22:30 ` [Bug c++/39901] " paolo dot carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tom dot prince at ualberta dot net @ 2009-04-25 21:27 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]

According to n2531, the new C++0x initializer-list is allowed in []. 

Test Case:

#include <map>

void test(void)
{
        std::map<std::pair<int,int>,int> the_map;
        the_map[{0,1}] = 5;
}

Error:
/tmp/test.cc: In function ‘void test()’:
/tmp/test.cc:6: error: expected primary-expression before ‘{’ token
/tmp/test.cc:6: error: expected ‘]’ before ‘{’ token
/tmp/test.cc:6: error: expected ‘;’ before ‘{’ token
/tmp/test.cc:6: error: expected primary-expression before ‘]’ token
/tmp/test.cc:6: error: expected ‘;’ before ‘]’ token

Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --enable-languages=c++ --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-multilib
--disable-bootstrap --prefix /Users/cougar/local/gcc45 : (reconfigured)
./config
ure --enable-shared --enable-threads=posix --enable-__cxa_atexit
--disable-multilib --disable-bootstrap --prefix /Users/cougar/local/gcc45
--enable-languages=c,c++ --no-create --no-recursion
Thread model: posix
gcc version 4.5.0 20090425 (experimental) (GCC)


-- 
           Summary: [C++0x] Initializer list not allowed in []
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tom dot prince at ualberta dot net
  GCC host triplet: x86_64-linux-gnu


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


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

* [Bug c++/39901] [C++0x] Initializer list not allowed in []
  2009-04-25 21:27 [Bug c++/39901] New: [C++0x] Initializer list not allowed in [] tom dot prince at ualberta dot net
@ 2009-04-25 22:30 ` paolo dot carlini at oracle dot com
  2009-07-31 16:17 ` paolo dot carlini at oracle dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-25 22:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2009-04-25 22:30 -------
Jason, can you have a look? Thanks.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


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


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

* [Bug c++/39901] [C++0x] Initializer list not allowed in []
  2009-04-25 21:27 [Bug c++/39901] New: [C++0x] Initializer list not allowed in [] tom dot prince at ualberta dot net
  2009-04-25 22:30 ` [Bug c++/39901] " paolo dot carlini at oracle dot com
@ 2009-07-31 16:17 ` paolo dot carlini at oracle dot com
  2009-07-31 16:26 ` paolo dot carlini at oracle dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-07-31 16:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2009-07-31 16:16 -------
I'm sorry Jason, a ping... ;)


-- 


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


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

* [Bug c++/39901] [C++0x] Initializer list not allowed in []
  2009-04-25 21:27 [Bug c++/39901] New: [C++0x] Initializer list not allowed in [] tom dot prince at ualberta dot net
  2009-04-25 22:30 ` [Bug c++/39901] " paolo dot carlini at oracle dot com
  2009-07-31 16:17 ` paolo dot carlini at oracle dot com
@ 2009-07-31 16:26 ` paolo dot carlini at oracle dot com
  2009-08-01 18:12 ` paolo dot carlini at oracle dot com
  2010-08-02  1:22 ` jsdeckerido at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-07-31 16:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2009-07-31 16:26 -------
Actually, this one seems invalid to me: std::map does *not* define an
operator[](std::initializer_list<>). Waiting a bit for Jason to confirm, then
closing.


-- 


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


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

* [Bug c++/39901] [C++0x] Initializer list not allowed in []
  2009-04-25 21:27 [Bug c++/39901] New: [C++0x] Initializer list not allowed in [] tom dot prince at ualberta dot net
                   ` (2 preceding siblings ...)
  2009-07-31 16:26 ` paolo dot carlini at oracle dot com
@ 2009-08-01 18:12 ` paolo dot carlini at oracle dot com
  2010-08-02  1:22 ` jsdeckerido at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-08-01 18:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot carlini at oracle dot com  2009-08-01 18:12 -------
Closing.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/39901] [C++0x] Initializer list not allowed in []
  2009-04-25 21:27 [Bug c++/39901] New: [C++0x] Initializer list not allowed in [] tom dot prince at ualberta dot net
                   ` (3 preceding siblings ...)
  2009-08-01 18:12 ` paolo dot carlini at oracle dot com
@ 2010-08-02  1:22 ` jsdeckerido at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jsdeckerido at gmail dot com @ 2010-08-02  1:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsdeckerido at gmail dot com  2010-08-02 01:22 -------
how is this invalid?

it shouldn't matter whether map defines operator[](std::initializer_list<>),
only operator[](std::pair<int,int>) for std::map<std::pair<int,int>,int>.

{1, 2} should then be used to initialize that pair.


-- 


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


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

end of thread, other threads:[~2010-08-02  1:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-25 21:27 [Bug c++/39901] New: [C++0x] Initializer list not allowed in [] tom dot prince at ualberta dot net
2009-04-25 22:30 ` [Bug c++/39901] " paolo dot carlini at oracle dot com
2009-07-31 16:17 ` paolo dot carlini at oracle dot com
2009-07-31 16:26 ` paolo dot carlini at oracle dot com
2009-08-01 18:12 ` paolo dot carlini at oracle dot com
2010-08-02  1:22 ` jsdeckerido at gmail dot com

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).