temporary object

Dr. Franz Fehringer fehrin@t-online.de
Wed Aug 27 19:43:00 GMT 2003


Replace void Foo(T&) with void Foo(const T&).

Franz

> Hi, All
> 	Why I cannot compile it when I use a temporary object as an parameter of a reference.
> but MSC can compile it sucessfully.
> 
> For example:
> 	
> 	struct T {
> 		int i;
> 		int j;
>     };
> 
> 	void Foo(T&) {
>     }
> 
>     int main() {
> 	   Foo(T(i,j));
>     }
> 
> 	Maybe g++ need some extra parameter to compile, what is?
> 
> Thanks in advance.



More information about the Gcc mailing list