Bug 17059 – [REG 2.072.2] incorrect circular reference with `is(Klass : Interface)`

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-01-04T03:28:00Z
Last change time
2017-01-16T23:26:08Z
Assigned to
nobody
Creator
b2.temp

Comments

Comment #0 by b2.temp — 2017-01-04T03:28:04Z
The regression appears between 2.072.1 and 2.072.2 test case: mixin template impl() { import std.traits : BaseClassesTuple; alias T = typeof(this); enum doImplement = is(T : I) && !(is(BaseClassesTuple!T[0] : I)); static if (doImplement) void method(){} } interface I {void method();} class A : I {mixin impl;} void main(){} fails to compile and outputs /tmp/temp_7F9D9403AD90.d(8,16): Error: circular reference to variable 'runnable.A.impl!().doImplement'
Comment #1 by b2.temp — 2017-01-04T04:25:24Z
If i trust a bisect made by hand, the fix for issue 16980 is the culprit, so this pull: https://github.com/dlang/dmd/pull/6383
Comment #2 by code — 2017-01-07T18:14:27Z
cat > bug.d << CODE mixin template impl() { alias T = typeof(this); enum doImplement = is(T : I) ; static if (doImplement) {} } interface I {} class A : I {mixin impl;} CODE dmd -c -o- bug ---- bug.d(6): Error: circular reference to variable 'bug.A.impl!().doImplement' bug.d(11): Error: mixin bug.A.impl!() error instantiating ---- > If i trust a bisect made by hand, the fix for issue 16980 is the culprit, so this pull: https://github.com/dlang/dmd/pull/6383 Digger confirms that it was introduced with https://github.com/dlang/dmd/pull/6383.
Comment #3 by github-bugzilla — 2017-01-10T06:32:14Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/c4ac1abed6e6aa95b1312d777f77fb634e2dac07 fix Issue 17059 - incorrect circular reference with `is(Klass : Interface)` - fixed by tweaking the fix for Issue 16980 (#6383) - happened b/c TypeClass::implicitConv -> TypeClass::constConv checks for offset == 0, which triggered size finalization - instead handle unfinalized classes in isBaseOf (new OFFSET_FWDREF) and only explicity finalize size before optimizing casts - add a halt for any OFFSET_FWDREF leaking through to IR gen https://github.com/dlang/dmd/commit/45c886fab62ed8a99ab054d3d5e9c2e6a38e429e Merge pull request #6412 from MartinNowak/fix17059 fix Issue 17059 - incorrect circular reference with `is(Klass : Interface)`
Comment #4 by github-bugzilla — 2017-01-15T01:21:02Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/c4ac1abed6e6aa95b1312d777f77fb634e2dac07 fix Issue 17059 - incorrect circular reference with `is(Klass : Interface)` https://github.com/dlang/dmd/commit/45c886fab62ed8a99ab054d3d5e9c2e6a38e429e Merge pull request #6412 from MartinNowak/fix17059
Comment #5 by github-bugzilla — 2017-01-16T23:26:08Z
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/c4ac1abed6e6aa95b1312d777f77fb634e2dac07 fix Issue 17059 - incorrect circular reference with `is(Klass : Interface)` https://github.com/dlang/dmd/commit/45c886fab62ed8a99ab054d3d5e9c2e6a38e429e Merge pull request #6412 from MartinNowak/fix17059