Bug 19538 – "alias this" does not work with opEquals()

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-01-02T07:09:31Z
Last change time
2024-12-13T19:01:52Z
Assigned to
No Owner
Creator
Victor Porton
Moved to GitHub: dmd#19523 →

Comments

Comment #0 by porton — 2019-01-02T07:09:31Z
This program does not compile. I think it should do. --- struct X { string m; alias m this; bool opEquals(const X s) const { return true; } } void main() { X* x = new X(""); assert(*x == ""); } --- $ dmd --version DMD64 D Compiler v2.080.1 Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright $ dmd test.d test.d(11): Error: function test.X.opEquals(const(X) s) const is not callable using argument types (string) test.d(11): cannot pass argument "" of type string to parameter const(X) s
Comment #1 by robert.schadek — 2024-12-13T19:01:52Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19523 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB