Implicit conversion to mutable if no indirections?

rikki cattermole rikki at cattermole.co.nz
Fri Sep 2 19:05:52 UTC 2022


```d
void main() {
	auto foo = const Foo("whatever");
	bar(foo);
}

struct Foo {
	char[] data;
}

void bar(T)(T value) {
	T thing = value;
	thing.data[0] = 'a';
}
```

Do you want this to error at compile time or at runtime due to writing 
to read only memory?


More information about the Digitalmars-d mailing list