Bug 13783 – Function overload with rvalue `inout` parameter not selected when `enum` parameter implicitly converted to its base type

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-11-27T11:53:00Z
Last change time
2015-02-18T03:40:41Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2014-11-27T11:53:24Z
This code should work fine: --- enum E { a } inout(int) f(inout(int) t) { return t; } ref inout(int) f(ref inout(int) t) { return t; } void main() { const E e; f(e); // line 9 } --- main.d(9): Error: constant 0 is not an lvalue --- May be related to Issue 12068.
Comment #1 by k.hara.pg — 2014-11-29T03:56:15Z
Comment #2 by github-bugzilla — 2014-12-02T05:25:53Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/638cededda9082a6c43e8541c16930900de90fc3 Supplemental fix for issue 13783 in std.parallelism `auto f(ref ubyte);` should not take an lvalue of `enum E : ubyte`. Fixing 13783 will disallow the accepts-invalid bug. https://github.com/D-Programming-Language/phobos/commit/ca2171d49ce58162e7489061588a2e2d3d5b1d8c Merge pull request #2773 from 9rnsr/fix13783 Supplemental fix for issue 13783 in std.parallelism
Comment #3 by github-bugzilla — 2014-12-06T16:54:10Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c0891db6300eec0f6a088f4d021c81c4457a6dfa fix Issue 13783 - Function overload with rvalue `inout` parameter not selected when `enum` parameter implicitly converted to its base type The root issue is a flaw in the overload resolution mechanism. For the function `auto f(ref T);`, an lvalue of `enum E : T` should not match. https://github.com/D-Programming-Language/dmd/commit/b27e1501a970c158f78874bb6f71355b7d6f7c5a Merge pull request #4177 from 9rnsr/fix13783 Issue 13783 - Function overload with rvalue `inout` parameter not selected when `enum` parameter implicitly converted to its base type
Comment #4 by github-bugzilla — 2015-02-18T03:40:09Z
Comment #5 by github-bugzilla — 2015-02-18T03:40:41Z
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c0891db6300eec0f6a088f4d021c81c4457a6dfa fix Issue 13783 - Function overload with rvalue `inout` parameter not selected when `enum` parameter implicitly converted to its base type https://github.com/D-Programming-Language/dmd/commit/b27e1501a970c158f78874bb6f71355b7d6f7c5a Merge pull request #4177 from 9rnsr/fix13783