[Bug c++/39901] [C++0x] Initializer list not allowed in []

2010-08-01 Thread jsdeckerido at gmail dot com


--- 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::pairint,int) for std::mapstd::pairint,int,int.

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


-- 


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



[Bug c++/45139] New: constructor call with a single variable as the argument is interpreted as a variable declaration if it's a full expression.

2010-07-30 Thread jsdeckerido at gmail dot com
Hopefully this isn't standard defined behavior, because it doesn't make much
sense.

// trying to have some overloaded functions to share some private data:

class A {
private:
// some static stuff
// ...

public:
A(int a, int b = 0) {}
// more versions of A(...)
// ...
};

int main() {
int a = 0;

A(a, 0); // works
A(a); // error: attempting to redeclare a
(A(a)); // this works
}


-- 
   Summary: constructor call with a single variable as the argument
is interpreted as a variable declaration if it's a full
expression.
   Product: gcc
   Version: 4.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jsdeckerido at gmail dot com


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