[Issue 12924] New: deprecated("foo"); and deprecated; should not compile

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jun 14 23:23:31 PDT 2014


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

          Issue ID: 12924
           Summary: deprecated("foo"); and deprecated; should not compile
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: jmdavisProg at gmx.com

This code compiles with no errors or deprecation messages:

deprecated("Don't use me!");
void foo()
{
}

void main()
{
    foo();
}

Of course, what it should be is

deprecated("Don't use me!")
void foo()
{
}

void main()
{
    foo();
}

and that _will_ give a deprecation warning. However, I don't think that the
problem is that the first example doesn't give a deprecation warning. Rather,
it should be an error, as deprecated isn't a statement. It's an attribute.

Whether there is a message or not doesn't seem to affect anything, e.g.

deprecated;
void foo()
{
}

void main()
{
    foo();
}

also compiles with no errors or deprecation warnings.

--


More information about the Digitalmars-d-bugs mailing list