Thread overview
[Issue 23274] [REG2.099] Wrong call resolution (ambiguity) with const and non-const methods
Dec 20, 2022
Iain Buclaw
Dec 21, 2022
anonymous4
July 29, 2022
https://issues.dlang.org/show_bug.cgi?id=23274

johanengelen@weka.io changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry, rejects-valid

--
July 29, 2022
https://issues.dlang.org/show_bug.cgi?id=23274

--- Comment #1 from johanengelen@weka.io ---
I'm not 100% what should happen here, so please think very carefully about if this is valid or invalid code. If valid, what function call should happen. (please think for more than 5 minutes)

--
December 20, 2022
https://issues.dlang.org/show_bug.cgi?id=23274

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
This is the introducing change: https://github.com/dlang/dmd/pull/13267

There used to be a test in xtest46.d which did exactly what you're doing here, but that was changed as part of the linked PR to fix...

--
December 21, 2022
https://issues.dlang.org/show_bug.cgi?id=23274

--- Comment #3 from anonymous4 <dfj1esp02@sneakemail.com> ---
Looks like D doesn't allow such overloads.
---
struct A
{
        int a;
        void b(const int[]);
        void b(int[]) const;
}
void e()
{
        int[] g;
        A a;
        a.b(g);
}
---
Up to 2.063: Failure with output:

onlineapp.d(11): Error: function onlineapp.A.b called with argument types:
        ((int[]))
matches both:
        onlineapp.d(4): onlineapp.A.b(const(int[]))
and:
        onlineapp.d(5): onlineapp.A.b(int[])

--
December 13
https://issues.dlang.org/show_bug.cgi?id=23274

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/20135

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--