www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12924] New: deprecated("foo"); and deprecated; should not

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 puremagic.com
          Reporter: jmdavisProg 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.

--
Jun 14 2014