good example of assert as expression ?
user1234
user1234 at 12.de
Mon Feb 16 12:19:38 UTC 2026
On Monday, 9 February 2026 at 22:19:42 UTC, user1234 wrote:
> Usually assert as expression will not work because of implicit
> convs.
A very classic example for me would be that you cannot manually
check a dot-var LHS:
```d
void main()
{
struct S { int m; }
S* s;
if ((s || assert(0)).m == 42) {}
}
```
The idea is just to panic on `s.m`. That being said, I've read
that that are plans for a new null-deref check.
More information about the Digitalmars-d
mailing list