Re: returning lvalue in C vs C++
- From: Alan Johnson <alanwj@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 01:14:54 -0800
Alf P. Steinbach wrote:
int main(void)
{
struct thing t = {20};
int y = (f() = t).x;
This is invalid in both C and C++.
Why is this invalid in C++? If I understand correctly, f() returns an rvalue of class type, and therefore you can call the operator= member for it.
For what it's worth, both g++ and Comeau think it is valid.
Alan
.
- Follow-Ups:
- Re: returning lvalue in C vs C++
- From: Alf P. Steinbach
- Re: returning lvalue in C vs C++
- References:
- returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Phlip
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Kai-Uwe Bux
- Re: returning lvalue in C vs C++
- From: Alf P. Steinbach
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Alf P. Steinbach
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Alf P. Steinbach
- returning lvalue in C vs C++
- Prev by Date: Re: Card dealing and random repetition
- Next by Date: Re: returning lvalue in C vs C++
- Previous by thread: Re: returning lvalue in C vs C++
- Next by thread: Re: returning lvalue in C vs C++
- Index(es):
Relevant Pages
|