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