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)
Jason, can you have a look? Thanks.
I'm sorry Jason, a ping... ;)
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.
Closing.
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.
Re-open...
... and resolve again as duplicate. *** This bug has been marked as a duplicate of bug 51738 ***