Re: dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2021-01-05 03:02, kdevel wrote: expected output: none. The compiler should have rejected the code after the duplicate definition def #2. dmd 2.093.1 ignores both definitions instead. Is this a bug or a bug? DMD 2.095.0 now reports an error for this. -- /Jacob Carlborg

Re: dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-04 Thread kdevel via Digitalmars-d-learn
On Tuesday, 5 January 2021 at 03:36:47 UTC, Paul Backus wrote: On Tuesday, 5 January 2021 at 02:02:39 UTC, kdevel wrote: [...] If you try to call .toString directly on a const(S), you get the following error: onlineapp.d(27): Error: onlineapp.S.toString called with argument types () const

Re: dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-04 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 5 January 2021 at 02:02:39 UTC, kdevel wrote: expected output: none. The compiler should have rejected the code after the duplicate definition def #2. dmd 2.093.1 ignores both definitions instead. Is this a bug or a bug? If you try to call .toString directly on a const(S), you get

dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-04 Thread kdevel via Digitalmars-d-learn
~~~tsnf.d import std.stdio: writeln; struct S { string s; string toString () { return __PRETTY_FUNCTION__ ~ `: ` ~ s; } string toString () const // def #1 { return __PRETTY_FUNCTION__ ~ `: ` ~ s; } const string toString () // def #2 { return __PRETTY_F