------- Comment #3 from Don at Skyler dot com 2006-01-30 12:39 ------- Subject: Re: Initializing using methods of class object passed to constructor
On 30 Jan 2006 10:29:01 -0000, you wrote: > > >------- Comment #2 from rguenth at gcc dot gnu dot org 2006-01-30 10:29 >------- >D d(Initializer()); > >parses as a function declaration, as you see from the error (which is on >the cout line btw.): Sorry, I don't get it. If the line were something like: D d(Initializer init); or D d(Initializer); I could understand. But D d(Initializer()) doesn't look like a function declaration to me. Initializer() is a (constructor) function call. It's not the right form for a parameter in a function prototype. Also, this was only one of two problems: when you replace that line with: Initializer init; D d(init); you get the wrong output. It should output i_=1. I was getting i_=0 when I posted the bug. At one point later I got i_=97. Seems like it's leaving the i_ member undefined. >// bug.cpp: In function `int main()': >// bug.cpp:35: error: request for member `i_' in `d', which is of >non-class type `D >// ()(Initializer (*)())' > >use > >D d((Initializer())); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26024