Bug 6864 – Const conversion should precedence over the shared one

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-10-30T06:49:00Z
Last change time
2011-10-31T12:10:56Z
Keywords
patch
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2011-10-30T06:49:25Z
BasicTypes can convert shared from/to non-shared with copy, but the shared conversion priority should be lower than const conversions. This means that following code should pass the assertions. int fn( const int n) { return 1; } int fn(shared int n) { return 2; } inout(int) fw(inout int s) { return 1; } inout(int) fw(shared inout int s) { return 2; } int n; assert(fn(n) == 1); assert(fw(n) == 1); shared int sn; assert(fn(sn) == 2); assert(fw(sn) == 2);
Comment #1 by k.hara.pg — 2011-10-30T07:52:33Z
Comment #2 by bugzilla — 2011-10-31T12:10:56Z