This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: temporary object


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]