shared and idup

Low Functioning via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 19 10:56:29 PDT 2014


shared int[] foo;
auto bar() {
	foo ~= 42;
	return foo.idup;
}
Error: cannot implicitly convert element type shared(int) to 
immutable in foo.idup

Is this not correct? If I instead dup'd an array of ints (or some 
other non-reference elements) and cast to immutable, would I be 
in danger of undefined behavior?


More information about the Digitalmars-d-learn mailing list