Bug 12744 – auto ref crashes DMD on ASSERT

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-13T12:36:00Z
Last change time
2015-09-04T21:31:01Z
Keywords
ice, pull
Assigned to
nobody
Creator
tomer

Comments

Comment #0 by tomer — 2014-05-13T12:36:42Z
This little snippet crashes the compiler (DMD 2.065) on an ASSERT: dmd: mtype.c:9958: void Parameter::toDecoBuffer(OutBuffer*): Assertion `0' failed. ============ void f(int x, out int y) {} void g(alias F)(auto ref ParameterTypeTuple!F args) {} void main() { int y; g!f(1, y); } ============ The issue is that "auto ref" adds 'ref' to y as well, causing a 'ref out' to be inferred, which then fails on an assert in the compiler. Took me half a day to hunt down.
Comment #1 by tomer — 2015-03-19T08:08:46Z
happens on dmd 2.66.1 as well: void f(int x, out int y) { } void g(ref ParameterTypeTuple!f params) { f(params); } dmd: mtype.c:9529: void Parameter::toDecoBuffer(OutBuffer*): Assertion `0' failed. [1] 14388 abort (core dumped) dmd source/main.d
Comment #2 by k.hara.pg — 2015-09-03T09:55:37Z
Comment #3 by github-bugzilla — 2015-09-04T21:31:00Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8f03ee45f9df1a0fdcca492cac575ab0d0b3fff0 fix Issue 12744 - auto ref crashes DMD on ASSERT https://github.com/D-Programming-Language/dmd/commit/37ee74a59eec69e48595c79f0f1340c9e1d637cf Merge pull request #5032 from 9rnsr/fix12744 Issue 12744 - auto ref crashes DMD on ASSERT