could not convert `obj(5)' to `obj &'
Nathan Sidwell
nathan@codesourcery.com
Wed Nov 12 11:40:00 GMT 2003
Jon Vance wrote:
>
> I have a bunch of code that used to compile under an older version of
> gcc, and will not do so using 2.96. Here is a very simple example of
> the problem I am having:
> void printit(obj& o)
void printit (obj const & o)
> {
> printf("%d\n", o.i);
> }
> g++ t.cpp -o t
> t.cpp: In function `int main ()':
> t.cpp:17: could not convert `obj(5)' to `obj &'
> t.cpp:11: in passing argument 1 of `printit (obj &)'
> make: *** [t] Error 1
you cannot bind a temporary to a non-constant reference
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
More information about the Gcc-help
mailing list