[Issue 7717] Regression(2.059): typeof(this) incorrect in mixin template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 16 03:08:06 PDT 2012


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


timon.gehr at gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr at gmx.ch


--- Comment #2 from timon.gehr at gmx.ch 2012-03-16 03:08:17 PDT ---
(In reply to comment #1)
> It's not clear that there's a bug here. typeof(this).init correctly shouldn't
> compile inside a mixin, because the mixin might add an extra field

It does not add an extra field.

> -- so then init would change.

If I added some random character to a valid d program, then it would likely not
be valid anymore. What does this prove?

> 
> .init is defined only when all possible members of the aggregate have been
> declared.

This is the case in the example. What should be illegal is adding a field that
changes .init based on a static condition that depends on .init. This would be
part of a necessary general overhaul of symbol lookup works in DMD: Forward
declarations and compile-time reflection make it possible to write
contradictory or ambiguous D programs. The compiler should detect such setups
in the least conservative way we can come up with.

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