D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5253 - Regression (2.050): in contracts are not allowed in overriden methods.
Summary: Regression (2.050): in contracts are not allowed in overriden methods.
Status: RESOLVED DUPLICATE of issue 5145
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Linux
: P2 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-21 18:27 UTC by Witold Baryluk
Modified: 2010-11-22 07:01 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 Witold Baryluk 2010-11-21 18:27:41 UTC
Minimal test case:

module strange_override_bug;

interface K {
	void f();
}

class A(int m) : K {
	override void f()
	in { }
	body { }
}

class B : A!(2) {
	void f() { }
}

/*
strange_override_bug.d(8): Error: variable strange_override_bug.A!(2).A.f.this override cannot be applied to variable
strange_override_bug.d(9): Error: function strange_override_bug.A!(2).A.f.__require override only applies to class member functions
*/

Compile with "in { }" line commented out!
Compiles also if i remove "override" keyword" (and it do not warn my about anything).

Was working in 2.049.
Comment 1 Witold Baryluk 2010-11-21 18:50:07 UTC
'int m' parameter in template is also important. Minimizing test case by removing it, make error disappear. Changing it to general template parameter (i.e. class A(T) : K) , also makes error disappear.
Comment 2 Don 2010-11-22 07:01:01 UTC

*** This issue has been marked as a duplicate of issue 5145 ***