[Issue 13982] New: D1: wrong template instantiation is not rejected
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jan 14 13:00:52 PST 2015
https://issues.dlang.org/show_bug.cgi?id=13982
Issue ID: 13982
Summary: D1: wrong template instantiation is not rejected
Product: D
Version: D1
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: public at dicebot.lv
void temp1 ( T ... ) ( char[] dest, T arrays )
{
temp2(dest, arrays[0]);
}
T[] temp2 ( T ) ( T[] dest, T[][] arrays )
{
return dest;
}
void main ( )
{
char[] email;
/*
*** Error in `dmd1': free(): invalid pointer: 0x00000000014451a0 ***
Aborted (core dumped)
*/
temp1!(int)(email, 12);
// ok
temp1(email, 12);
}
dmd2 rejects this code:
aaa.d(4): Error: template aaa.temp2 cannot deduce function from argument types
!()(char[], int), candidates are:
aaa.d(7): aaa.temp2(T)(T[] dest, T[][] arrays)
aaa.d(20): Error: template instance aaa.temp1!int error instantiating
--
More information about the Digitalmars-d-bugs
mailing list