D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7697 - Default argument in template method throws AssertError
Summary: Default argument in template method throws AssertError
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-13 02:57 UTC by aneas
Modified: 2018-10-19 05:46 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 aneas 2012-03-13 02:57:06 UTC
class C {
	void method(alias F = function(int i) {})() {
		int i;
		F(i);
	}
}

void main() {
	C c = new C;
	c.method!(function(int i) {})(); // works
	c.method(); // core.exception.AssertError@./bug.d(2): null this
}



AssertError does not occur with:
void method(alias F = function() {})() {
	int i;
	F();
}
Comment 1 Mathias LANG 2018-10-19 05:46:52 UTC
I just ran the snippet, and it does not throw anymore. Closing.