Bug 4449 – ICE(glue.c) on failed type inference against associative array
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2010-07-12T13:14:00Z
Last change time
2014-02-15T02:44:08Z
Keywords
ice-on-invalid-code
Assigned to
nobody
Creator
rsinfu
Comments
Comment #0 by rsinfu — 2010-07-12T13:14:52Z
DMD (r576) aborts with assertion failure if type inference against an associative array fails with a struct/union argument.
-------------------- test.d
template Test(T : V[K], K, V) {}
struct S {}
enum pred = __traits(compiles, Test!S);
--------------------
% dmd -c test
Assertion failed: (0), function totym, file glue.c, line 1056.
--------------------
The abort does not occur if the template argument is not a struct.
--------------------
template Test(T : V[K], K, V) {}
enum pred = __traits(compiles, Test!int);
--------------------
The abort does not occur if the infered type is not an associative array.
--------------------
template Test(T : V[], V) {}
struct S{}
enum pred = __traits(compiles, Test!S);
--------------------
The abort does not occur if the failure is not gagged.
--------------------
template Test(T : V[K], K, V) {}
struct S {}
alias Test!S X;
--------------------
% dmd -c test
test.d(1): Error: cannot create associative array V[K]
test.d(3): Error: template instance Test!(S) does not match template declaration Test(T : V[K],K,V)
--------------------
Comment #1 by clugdbug — 2010-07-13T08:14:33Z
*** This issue has been marked as a duplicate of issue 3996 ***