[Issue 22342] New: importC: Error: function 'func()' is not callable using argument types '(int)'
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 28 17:44:17 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22342
Issue ID: 22342
Summary: importC: Error: function 'func()' is not callable
using argument types '(int)'
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
In C11, having an empty parentheses `()` is equivalent to D `(...)`, and so the
following should not error.
---
void func() { }
int main()
{
func(12);
func("12");
func(1.2);
return 0;
}
---
The correct code in order to induce the error we want is to use `(void)`
---
void func(void) { }
int main()
{
func(12); // error: too many arguments
func("12"); // error: too many arguments
func(1.2); // error: too many arguments
return 0;
}
---
--
More information about the Digitalmars-d-bugs
mailing list