digitalmars.D.bugs - [Issue 17512] New: [REG 2.073] wrong deduction of "return" function
- via Digitalmars-d-bugs (37/39) Jun 15 2017 https://issues.dlang.org/show_bug.cgi?id=17512
https://issues.dlang.org/show_bug.cgi?id=17512 Issue ID: 17512 Summary: [REG 2.073] wrong deduction of "return" function attribute Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: johanengelen weka.io Testcase: ``` struct A(T) { T _value; bool _hasValue; auto ref getOr(T alternativeValue) { return _hasValue ? _value : alternativeValue; } } A!int a; ``` DMD 2.073 fails with:dmd -c testcase.d -o-testcase.d(7): Error: function has 'return' but does not return any indirections testcase.d(13): Error: template instance testcase.A!int error instantiating DMD 2.074:dmd -c testcase.d -o-testcase.d(7): Error: function type 'pure nothrow nogc return safe int(int alternativeValue)' has 'return' but does not return any indirections testcase.d(13): Error: template instance manhole.A!int error instantiating DMD 2.072.2 compiles it fine. --
Jun 15 2017