December 03, 2020
https://issues.dlang.org/show_bug.cgi?id=21449

          Issue ID: 21449
           Summary: parser reject constructor call to
                    const(SomeStructDecl)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: b2.temp@gmx.com

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.

--