[Issue 4595] [tdpl] Accessing non-static member of a null reference compiles

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 18 20:21:13 PST 2011


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


Andrei Alexandrescu <andrei at metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei at metalanguage.com
            Summary|Accessing non-static member |[tdpl] Accessing non-static
                   |of a null reference         |member of a null reference
                   |compiles                    |compiles


--- Comment #12 from Andrei Alexandrescu <andrei at metalanguage.com> 2011-12-18 20:20:09 PST ---
Failing unittest in TDPL:

unittest
{
  class A { int x; }
  A a;
  assert(!__traits(compiles, a.x = 5));
}

Such programs must be statically rejected, guaranteed if there's no intervening
flow in between definition and first use. We can work on improving that later,
but for now let's get the obvious case out of the way.

-- 
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