www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16600] New: Wrong error message for ambiguous

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

          Issue ID: 16600
           Summary: Wrong error message for ambiguous mutable/immutable
                    constructor
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

For this code:

struct S {
    this(string);
    this(string) immutable;
}

void main() {
    auto a = const(S)("abc");
}

the error message is:

t.d(7): Error: t.S.__ctor called with argument types (string) const matches
both:
t.d(2):     t.S.this(string)
and:
t.d(3):     t.S.this(string)

Should be:

t.d(7): Error: t.S.__ctor called with argument types (string) const matches
both:
t.d(2):     t.S.this(string)
and:
t.d(3):     t.S.this(string) immutable

--
Oct 06 2016