Functions that return by ref their formal parameters (or the this implicit parameter) need to have the return attribute, so the compiler can catch cases where the return value outlives the function argument it
was derived from. This attribute is inferred (just like e.g. nothrow or pure) for function templates (or functions defined inside templates), nested functions and auto-returning functions.
The -dip25 flag enforces this static analysis and it will become the default in one the future releases.
This pull request enables this flag and fixes the compilation errors.
We're currently in the process of fixing projects on BuildKite such as yours, in order to ease the community for the transition. The transition is most likely going to happen through a deprecation phase (e.g. it won't be a hard-error for one more releases), but it's a good idea to prepare in advance.
Functions that return by
ref
their formal parameters (or thethis
implicit parameter) need to have thereturn
attribute, so the compiler can catch cases where the return value outlives the function argument it was derived from. This attribute is inferred (just like e.g.nothrow
orpure
) for function templates (or functions defined inside templates), nested functions andauto
-returning functions. The-dip25
flag enforces this static analysis and it will become the default in one the future releases.This pull request enables this flag and fixes the compilation errors.
We're currently in the process of fixing projects on BuildKite such as yours, in order to ease the community for the transition. The transition is most likely going to happen through a deprecation phase (e.g. it won't be a hard-error for one more releases), but it's a good idea to prepare in advance.