D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5095 - Error for typesafe variadic functions for structs
Summary: Error for typesafe variadic functions for structs
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 minor
Assignee: No Owner
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2010-10-21 14:07 UTC by bearophile_hugs
Modified: 2021-03-19 19:22 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-10-21 14:07:55 UTC
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.
Comment 1 Infiltrator 2014-03-19 03:52:26 UTC
In v2.065, this produces:

Error: function f14.test (Foo f...) is not callable using argument types (int)

Is that acceptable; or do you still want the second part which you suggested?
Comment 2 bearophile_hugs 2014-03-19 04:23:26 UTC
(In reply to comment #1)
> In v2.065, this produces:
> 
> Error: function f14.test (Foo f...) is not callable using argument types (int)
> 
> Is that acceptable; or do you still want the second part which you suggested?

The error message is acceptable. Closed issue.