Bug 7832 – opAssign does not get used for function parameters with a default value

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2012-04-05T15:35:00Z
Last change time
2012-05-07T15:30:56Z
Assigned to
nobody
Creator
nyphbl8d

Comments

Comment #0 by nyphbl8d — 2012-04-05T15:35:30Z
So if I define an opAssign for a struct with void* as the parameter like so: struct test {void opAssign(void*mynull) {}} It works great when used in a normal assignment like so: void main () { test t = null; // compiles just fine } but refuses to compile for function parameters with default values of null like so: void tfunc(test t = null) {} // nope nope nope nope This occurs in 2.058.
Comment #1 by nyphbl8d — 2012-04-20T05:51:42Z
It was late when I submitted this, so I wasn't thinking about what was actually going on here. The null assignment as a default parameter is treated as though it were passed as an argument which would require some way to cast implicitly.... So given that, this really becomes a feature request for implicit casting support.