Bug 1460 – Compiler crash on valid code

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-08-31T02:25:00Z
Last change time
2014-02-16T15:26:01Z
Assigned to
bugzilla
Creator
samukha

Comments

Comment #0 by samukha — 2007-08-31T02:25:47Z
D 2.003 crashes as well. struct S { int x; } S foo(alias s)() { const S ret = bar(s); return ret; } S bar(S s) { return s; } S baz(int x)() { const S s = {x}; return foo!(s)(); } const r = baz!(1)();
Comment #1 by bugzilla — 2007-09-01T14:26:20Z
I'll fix the crashing problem, but the resulting code still won't work. That's because the template arguments are evaluated before trying to match them up with a template. That means the const declaration of s is replaced with a struct literal S(1). Struct literals don't match aliases.
Comment #2 by samukha — 2007-09-02T06:13:07Z
A regrettable limitation and somewhat inconsistent with cases like passing uninitialized constant to alias parameter (issue 1456)
Comment #3 by bugzilla — 2007-09-28T22:16:16Z
Fixed dmd 1.021 and 2.004