Bug 1946 – Compiler crashes on attempt to implicit cast const typedef to non-const.
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-03-26T06:33:00Z
Last change time
2015-06-09T01:14:37Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
sardonicpresence
Comments
Comment #0 by sardonicpresence — 2008-03-26T06:33:37Z
If an attempt is made to implicitly cast a const instance of a typedef of a class to a non-const instance, DMD 2.012 crashes.
The following code causes the compiler to crash:
class Foo {}
typedef Foo Test;
void f(Test test) {}
void main()
{
const Test test;
f(test);
}
If "typedef" is replaced with "alias" this does not occur. If "f(Test test)" is declared as "f(in Test test)" this does not occur. If Test is typedef'd to a value-type this does not occur (including structs).