--- Comment #4 from Steven Schveighoffer <>  2009-07-29 
10:11:26 PDT ---
(In reply to comment #3)
> Actually the compiler wouldn't have to do anything special here.  If the 
> return
> of foo() were an rvalue, then *foo().a could still be an lvalue, not because 
> of
> any special rules, but because of how the dereference operator works.

Yes, that would be helpful.

I think you are right that it can be determined in simple cases, but for sure
there will be cases that the compiler cannot diagnose, such as:

int _global;

struct S
  int _x;
    void x(int n) { _x = n;}
    void x(int n) { _global = n;}

struct S2
  S foo() { return S(5);}

void main()
  S2 s2; = 5;

How does the compiler know when compiling with noop that the = 5
doesn't do anything?  Especially if the module containing main is using a di
file to define S and S2.

The result is, I don't think the compiler can diganose the complex cases, and
most of the time, the cases are complex.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to