1460 – Compiler crash on valid code

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1460 - Compiler crash on valid code
Summary: Compiler crash on valid code
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 blocker
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2007年08月31日 02:25 UTC by Max Samukha
Modified: 2014年02月16日 15:26 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Max Samukha 2007年08月31日 02:25:47 UTC
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 Walter Bright 2007年09月01日 14:26:20 UTC
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 Max Samukha 2007年09月02日 06:13:07 UTC
A regrettable limitation and somewhat inconsistent with cases like passing uninitialized constant to alias parameter (issue 1456)
 
Comment 3 Walter Bright 2007年09月28日 22:16:16 UTC
Fixed dmd 1.021 and 2.004


AltStyle によって変換されたページ (->オリジナル) /