mixin template had error by calling shared function

Vlasov Roman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 10 01:10:45 PST 2014


I have this code

import std.stdio;

mixin template Template(void function() func1, void function() 
func2) {

	void 	to() {
		func1();
		func2();
	}
};

class SomeClass {
	mixin Template!(&func, &func23);

	void func() {
		writeln("First function!");
	}

	void func23() {
		writeln("First function!");
	}

	void toTemplate() {
		to();
	}
}

void main() {
	SomeClass a = new SomeClass();

	a.toTemplate();
}

After running the program give me SIGSEGV in func23();

Terminal with gdb:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000428352 in invariant._d_invariant(Object) ()
(gdb) up
#1  0x00000000004257f7 in main.SomeClass.func23() ()


Manjaro Linux 0.9.0 x86_64
dmd 2.066
Kernel 3.14.4


More information about the Digitalmars-d-learn mailing list