Platform: x86 (Pentium 4 2.8 GHz with MT) The following code does not compile, it appears that g++ is interpreting the declaration of myvar to be a function prototype:
[EMAIL PROTECTED]:~> g++3.4.2 -v Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.2/specs Configured with: ./configure --program-suffix=3.4.2 Thread model: posix gcc version 3.4.2 [EMAIL PROTECTED]:~> g++3.4.2 -Wall -o testcpp testcpp.cpp testcpp.cpp: In function `int main(int, char**)': testcpp.cpp:19: error: request for member `m' in `myvar', which is of non-class type `x ()(y)' testcpp.cpp:17: warning: unused variable 'v' testcpp.cpp:19: warning: unused variable 'v2' [EMAIL PROTECTED]:~> The code: class y { public: y(int n) : n(n) {} int n; }; class x { public: x(y m) : m(m) {} y m; }; int main(int argc, char *argv[]) { int v = 1; x myvar(y(v)); int v2 = myvar.m.n; } -- Summary: g++ interprets a variable declaration as a function prototype when the arguments to the constructor are temporaries Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schveiguy at yahoo dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18000