D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7144 - [CTFE] base class does not call overridden members
Summary: [CTFE] base class does not call overridden members
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-20 07:05 UTC by Rainer Schuetze
Modified: 2011-12-21 15:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Rainer Schuetze 2011-12-20 07:05:44 UTC
module test;

class A
{
	int foo() { return 0; }
	
	int callfoo()
	{
		return foo();
	}
}

class B : A
{
	override int foo() { return 1; }
}

int test()
{
	A a = new B;
	return a.callfoo();
}

static assert(test() == 1);


Compiling with "dmd -c test.d" yields:
test.d(24): Error: static assert  (0 == 1) is false

If you use "a.foo()" instead of "a.callfoo()", the assert succeeds.