Bug 7697 – Default argument in template method throws AssertError
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-13T02:57:06Z
Last change time
2018-10-19T05:46:52Z
Assigned to
No Owner
Creator
aneas
Comments
Comment #0 by alexander.breckel — 2012-03-13T02:57:06Z
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 by pro.mathias.lang — 2018-10-19T05:46:52Z
I just ran the snippet, and it does not throw anymore. Closing.