Help needed: immutable struct is a type modifier, and that's wrong and broken

Jacob Carlborg doob at me.com
Fri Mar 13 14:49:49 UTC 2020


On Friday, 13 March 2020 at 14:17:45 UTC, FeepingCreature wrote:

> Okay, so you're saying there's an immutable modifier on S, but 
> it doesn't do anything because all the fields are immutable too?

Well, it looks like the spec is kind of correct:

"A struct declaration can have a storage class of const, 
immutable or shared. It has an equivalent effect as declaring 
each member of the struct as const, immutable or shared"

What happens if the struct doesn't have any members? If there are 
no members that can be immutable then the struct can't be 
immutable?

I don't know.

--
/Jacob Carlborg


More information about the Digitalmars-d mailing list