Bug 19891 – Confusing error message for auto ref parameters with default values
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-05-22T23:11:35Z
Last change time
2019-06-06T07:03:47Z
Keywords
pull, rejects-valid
Assigned to
Suleyman Sahmi (سليمان السهمي)
Creator
Yuxuan Shui
Comments
Comment #0 by yshuiv7 — 2019-05-22T23:11:35Z
void fun(R)(auto ref int a, auto ref R r = 1) {}
void main() {
fun(10, 2); // Error: cannot modify constant `1`
fun(10); // Error: `auto` can only be used as part of `auto ref` for template function parameters
}
The error messages make sense in neither of the cases.
@SSoulaimane updated dlang/dmd pull request #9894 "Fix issue 19891 - Confusing error messages for auto ref parameters with default values" fixing this issue:
- Fix issue 19891 - Confusing error messages for auto ref parameters with default values
https://github.com/dlang/dmd/pull/9894
Comment #3 by dlang-bot — 2019-06-06T07:03:47Z
dlang/dmd pull request #9894 "Fix issue 19891 - Confusing error messages for auto ref parameters with default values" was merged into master:
- b8869f61d85d7012ecb4919669971c68be517a48 by سليمان السهمي (Suleyman Sahmi):
Fix issue 19891 - Confusing error messages for auto ref parameters with default values
https://github.com/dlang/dmd/pull/9894