Bug 5068 – opOpAssign fails when if()-constraint is used
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-10-17T00:27:00Z
Last change time
2010-10-17T00:35:11Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bus_dbugzilla
Comments
Comment #0 by bus_dbugzilla — 2010-10-17T00:27:26Z
class Foo
{
Foo opOpAssign(string op)(Foo b) if(op=="~=")
{
return this;
}
}
void main()
{
Foo f = new Foo();
// Error: cannot append type test.Foo to type test.Foo
f ~= new Foo();
}
Comment #1 by bus_dbugzilla — 2010-10-17T00:34:43Z
Nevermind, I apparently can't read the docs right. This is how it's supposed to be, and it does work right:
Foo opOpAssign(string op)(Foo b) if(op=="~")