Is this a violation of const?

Salih Dincer salihdb at hotmail.com
Fri Jul 29 23:23:06 UTC 2022


On Friday, 29 July 2022 at 23:15:14 UTC, Salih Dincer wrote:
> It's smart to use `delegate`, but `immutable` doesn't 
> necessarily mean `const`.  So if we use `const char`:
>
> ```d
> struct S
> {
>     char s;
>
>     void delegate(char s) update;
> }
> ```
Pardon 😀

I forgot the assert test, also writing const in front of char...

Won't compile now:
```d
struct S
{
     const char s;

     void delegate(const char s) update;
}
```

SDB at 79




More information about the Digitalmars-d-learn mailing list