D-Programming-Language/dmd — pull request #1687 by 9rnsr (2013-02-24 04:05:01+00:00)
Title: Fix right this check

(This change is based on #1406)

Currently, dmd front-end does not detect incorrect field access that has no valid 'this' context. Such invalid expression will be detected in glue layer later.

```d
struct S { int val; }
void main() { int n = S.val; } // !
```

This change fixes the issue. The call of `resolveProperties` is good place to check it.

Some "symbol/type related" expressions, e.g. `S.val.offsetof`, `S.val.init`, are still valid after this change.

A symbol access through "alias this" is treated specially. If `Type.member` is implicitly translated to `Type.aliasthis.member`, it is further translated to `typeof(Type.aliasthis).member`.

---

This change additionally fixes:
[Issue 1680](http://d.puremagic.com/issues/show_bug.cgi?id=1680) - static struct constructor overloaded with method prevents compilation in inner function