Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't deprecate default construction #18986

Open
dlangBugzillaToGithub opened this issue May 4, 2015 · 0 comments
Open

can't deprecate default construction #18986

dlangBugzillaToGithub opened this issue May 4, 2015 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Martin Nowak (@MartinNowak) reported this on 2015-05-04T17:17:01Z

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

Description

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant