view tests/mini/classes13_bug239.d @ 1621:fb2e6707ad17

Merge DMD r314+r315: bugzilla 2029 Typesafe variadic functions don't... Both DMD revisions are for fixing bugzilla 2029 (Typesafe variadic functions don't work in CTFE). The DMD r314 commit message is: bugzilla 2029 (Typesafe variadic functions don't work in CTFE The DMD r315 commit message is: bugzilla 2029 - try again --- dmd/constfold.c | 11 ++++- dmd/declaration.c | 21 +++++++++- dmd/declaration.h | 10 ++++- dmd/expression.c | 1 + dmd/interpret.c | 111 +++++++++++++++++++++++++++++++++++++++++++++-------- dmd/mars.h | 2 +- dmd/mtype.c | 2 +- 7 files changed, 135 insertions(+), 23 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:22 -0300
parents 9d308feaec27
children
line wrap: on
line source

extern(C) int printf(char*, ...);

class A {
    bool Afoo = false;
    void foo() { Afoo = true; }
}

class B : A {}

class C : B {
    bool Cfoo = false;
    void foo() { Cfoo = true; }
}

void main()
{
        scope c1 = new C();
        c1.foo();
	assert(c1.Cfoo && !c1.Afoo);
	
	scope c2 = new C();
	c2.B.foo();
	assert(!c2.Cfoo && c2.Afoo);

	scope c3 = new C();
	c3.A.foo();
	assert(!c3.Cfoo && c3.Afoo);
}