using the ctor as an unary in an expstmt is an error (no effect) but for static opCall this can be valid.
---
struct Foo
{
static opCall(T)(T t){}
}
void main()
{
Foo(0); //OK
const(Foo(0)); //NG
}
---
>/tmp/temp_7F00CFE49E90.d:13:14: Error: unexpected `(` in declarator
>/tmp/temp_7F00CFE49E90.d:13:15: Error: basic type expected, not `0`
>/tmp/temp_7F00CFE49E90.d:13:15: Error: found `0` when expecting `)`
>/tmp/temp_7F00CFE49E90.d:13:17: Error: no identifier for declarator `const Foo(_error_)`
>/tmp/temp_7F00CFE49E90.d:13:17: Error: semicolon expected following function declaration
>/tmp/temp_7F00CFE49E90.d:13:17: Error: found `)` instead of statement
found by Herringway as seen on IRC.
Comment #1 by b2.temp — 2020-12-03T09:11:07Z
sorry, test case should be
---
struct Foo
{
static opCall(T)(T t){}
}
void main()
{
Foo(0); //OK
const(Foo)(0); //NG
}
---