[Issue 14545] New: can't deprecate default construction

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 4 10:17:01 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14545

          Issue ID: 14545
           Summary: can't deprecate default construction
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: code at dawg.eu

cat > enh.d << CODE
struct Foo
{
    deprecated("use foo() instead")
    this();
}
CODE

dmd -c enh

----
Error: constructor enh.Foo.this default constructor for structs only allowed
with @disable and no body
----

There is no mean to deprecate default construction of a struct before finally
disabling it.
We should enhance the compiler so that the above declaration is valid and using
`Foo foo;` would emit a deprecation warning.

--


More information about the Digitalmars-d-bugs mailing list