[Issue 5153] New: Struct pointer to struct variable assign error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 1 13:24:58 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5153

           Summary: Struct pointer to struct variable assign error message
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-11-01 13:24:03 PDT ---
This is wrong D2 code, it contains a common mistake (f is a Foo instead of the
correct Foo*):


struct Foo {
    int x;
    this(int x_) {
        this.x = x_;
    }
}
void main() {
    Foo f = new Foo(0);
}


DMD 2.050 gives the error messages that don't look correct:

test.d(8): Error: constructor test3.Foo.this (int x_) is not callable using
argument types (Foo*)
test.d(8): Error: cannot implicitly convert expression (new Foo(0)) of type
Foo* to int


But I was expecting a single error message similar to:

test.d(8): Error: cannot implicitly convert expression (new Foo(0)) of type
Foo* to Foo

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list