Bug 2353 – Assertion failure on template function auto return type deduction
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-09-11T10:48:00Z
Last change time
2015-06-09T01:20:17Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
snake.scaly
Comments
Comment #0 by snake.scaly — 2008-09-11T10:48:14Z
The following code:
auto Sub(T:E[S],E,size_t S)(T arr) {return cast(E[S-1])arr[1..$];}
pragma(msg, typeof(Sub("foo")).stringof);
causes output:
>dmd -c test2.d
test2.d(4): Error: forward reference to type T
test2.d(4): Error: cannot implicitly convert expression ("foo") of type invariant(char[3u]) to T
Assertion failure: 'type' on line 6308 in file 'expression.c'
abnormal program termination