Passing temporary class instantiation as an argument by reference

Laine Walker-Avina lwalkera@ieee.org
Fri Sep 21 16:32:00 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have some code I'm porting that looks similar to this:

class foo {

void testmember(bar &arg);

}

int main(void) {

foo test(bar(arg1, arg2, arg3));

}

It give me an error like this:

error: no matching function for call to 'foo::testmember(bar)'
note: valid candidates are: void foo::testmember(bar&)

Is there a flag or something I can use to get this to compile, or do  
I have to create a temporary copy of what I'm passing into the member  
before I call it?

- -Laine Walker-Avina
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)

iD8DBQFG8+vuZlPeU4S0oG8RAmf2AKCGrvG26go/DJ1G03hIYg+dy6031QCfcdCm
k0fh2jtSUFKLby48trL8q3s=
=Z2o5
-----END PGP SIGNATURE-----



More information about the Gcc-help mailing list