Can someone tell me what the compiler thought I was trying to do?
H. S. Teoh
hsteoh at qfbox.info
Wed Oct 19 00:57:31 UTC 2022
On Sat, Oct 15, 2022 at 12:47:02AM +0000, Mike Parker via Digitalmars-d-learn wrote:
> On Friday, 14 October 2022 at 22:17:52 UTC, H. S. Teoh wrote:
>
> > Given that this particular trap crops up regularly, perhaps some
> > sort of warning ought to be added. Once the @nodiscard DIP is
> > accepted & implemented this should be easy to do.
> >
>
> Seems like you're behind the times! The DIP was accepted and implemented
> with some changes:
>
> https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1038.md#final-review
Has it really been implemented? I tested the latest git master, the
following code doesn't compile:
------
@mustUse int fun() { return 455; }
void main() {
fun();
}
------
Compiler output:
------
/tmp/test.d(1): Error: undefined identifier `mustUse`
------
I tried @mustuse, @nodiscard, @noDiscard, no good. What am I missing?
T
--
This is not a sentence.
More information about the Digitalmars-d-learn
mailing list