[Issue 23274] [REG2.099] Wrong call resolution (ambiguity) with const and non-const methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 21 13:55:32 UTC 2022


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

--- Comment #3 from anonymous4 <dfj1esp02 at 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[])

--


More information about the Digitalmars-d-bugs mailing list