Bug 3429 – Core dump on passing template literal to member function.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-10-20T18:22:00Z
Last change time
2015-06-09T01:26:56Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2009-10-20T18:22:13Z
struct Foo { void doStuff(alias fun)() {} } void main() { Foo foo; foo.doStuff!( (i) { return i; })(); }
Comment #1 by clugdbug — 2009-10-21T02:26:17Z
Looks very similar to bug 2325 (but 2325 is D1-only). Probably has the same root cause.
Comment #2 by clugdbug — 2009-10-21T03:24:08Z
This one is trivial. PATCH: template.c, line 4139. d needs to be initialized BEFORE the goto, because it is used in the error message. Declaration *d = NULL; TemplateDeclaration *td = sa->isTemplateDeclaration(); + d = sa->isDeclaration(); if (td && td->literal) { goto L2; } - d = sa->isDeclaration(); if (d && !d->isDataseg() && #if DMDV2 !(d->storage_class & STCmanifest) && #endif (!d->isFuncDeclaration() || d->isFuncDeclaration()->isNested()) && !isTemplateMixin()) { L2: Actually, I'm not sure why this goto is even there. It could just be a clause in the 'if' statement!
Comment #3 by Kosmonaut — 2009-10-31T21:39:12Z
Comment #4 by bugzilla — 2009-11-06T11:35:00Z
Fixed dmd 2.036