Open
Description
If parens are omitted on a function call performed inside of an interpolated expression passed to an operator overload — such as foo = i"$(helloWorld)"
or foo ~ i"$(helloWorld)"
— the function will not be called.
string helloWorld() {
return "Hello, World!";
}
struct Foo {
void opAssign(Ts...)(Ts) {
}
void fun(Ts...)(Ts) {
}
}
void main() {
Foo foo;
foo.fun(i"$(helloWorld)"); // works
foo = i"$(helloWorld)"; // fails
}
The error message is also very confusing, because it does not point to the invocation, but only to the template:
onlineapp.d(6): Error: cannot have parameter of function type `string()`
Metadata
Metadata
Assignees
Labels
No labels