DMD 2.092 and DIP 25

Mike Parker aldacron at gmail.com
Sat May 30 07:00:07 UTC 2020


The following declarations now give a deprecation warning:

```d
struct ErrorInfo {
private:
     char[32] _error;
     char[96] _message;

public @nogc nothrow @property:
     /**
         Returns the string "Missing Symbol" to indicate a symbol 
load failure, and
         the name of a library to indicate a library load failure.
     */
     const(char)* error() const { return _error.ptr; }

     /**
         Returns a symbol name for symbol load failures, and a 
system-specific error
         message for library load failures.
     */
     const(char)* message() const { return _message.ptr; }
}
```

I find it rather annoying, as I'm returning `const(char)*` and 
not `char*`, but it is what it is. My question is, if I add 
`return` to the function declarations, will this compile all the 
way back to DMD 2.067 *without* `-preview=dip25`? It works on 
2.091.0. I always assumed a preview feature's syntax wasn't 
supported without the preview switch.


More information about the Digitalmars-d-learn mailing list