[Issue 3008] Members of non-lvalues can be assigned to.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 19 07:01:52 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3008


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com




--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com>  2009-05-19 07:01:51 PDT ---
Consider this actually sensical case:

struct S
{
  int *a;
}

S foo() {...}

*foo.a = 3;

Clearly, you don't want structs to be non-modifyiable in all cases.  If S has
member functions which modify both values of S and values S references, then
you should able to call those functions also.  It might be very difficult for
the compiler to distinguish all these cases.

I'd say the case you give is non-sensical, but still valid code.

This is also non-sensical code, in the same light, and I don't think it should
be a compiler error:

void foo()
{
   int x;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list