www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is it bug compiler?

reply MGW <mgw yandex.ru> writes:
Windows 7 32bit
-----------------------
import std.stdio;
import std.conv;

class CFormaMain {
  	~this() {
		char[] zz = [ 'A', 'B', 'C' ];
		writeln(to!string(zz));
	}
}

int main(string[] args) {
  	CFormaMain formaMain;
	formaMain = new CFormaMain();
	return 0;
}
-----------------------
core.exception.InvalidMemoryOperationError src\core\exception.d(693): Invalid me
mory operation
May 12 2016
next sibling parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 5/12/16 9:20 AM, MGW wrote:
 Windows 7 32bit
 -----------------------
 import std.stdio;
 import std.conv;

 class CFormaMain {
       ~this() {
          char[] zz = [ 'A', 'B', 'C' ];
This allocates. Allocations are not allowed in GC collection cycle. -Steve
May 12 2016
prev sibling parent Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Thursday, 12 May 2016 at 13:20:35 UTC, MGW wrote:
 Windows 7 32bit
 -----------------------
 import std.stdio;
 import std.conv;

 class CFormaMain {
  	~this() {
 		char[] zz = [ 'A', 'B', 'C' ];
 		writeln(to!string(zz));
 	}
 }

 int main(string[] args) {
  	CFormaMain formaMain;
 	formaMain = new CFormaMain();
 	return 0;
 }
 -----------------------
 core.exception.InvalidMemoryOperationError src\core\exception.d(693): Invalid
me
 mory operation
No. Look at the documentation of InvalidMemoryOperationError.
May 12 2016