www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5095] New: Error for typesafe variadic functions for structs

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

           Summary: Error for typesafe variadic functions for structs
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This is a wrong D2 progra:

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



DMD 2.049 shows at compile-time:

test.d(9): Error: function test2.test (Foo f...) is not callable using argument
types (int)
test.d(9): Error: cannot implicitly convert expression (1) of type int to Foo



But I'd like a better single error message, like for example:

test.d(9): Error: function test2.test (Foo f...) is not callable using argument
types (int), typesafe variadic functions for structs are not supported.

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