[Issue 4366] New: ICE(mtype.c) constrained template pure function with array/pointer parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 22 04:56:07 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4366
Summary: ICE(mtype.c) constrained template pure function with
array/pointer parameter
Product: D
Version: 2.041
Platform: All
OS/Version: All
Status: NEW
Keywords: ice-on-valid-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: rsinfu at gmail.com
--- Comment #0 from Shin Fujishiro <rsinfu at gmail.com> 2010-06-22 04:56:04 PDT ---
DMD aborts with assertion failure in Type::check() if a constrained templated
pure function has a named parameter of array or pointer type.
Compiling the following causes dmd to abort (2.045 and r556):
--------------------
void foo(T)(T a, T[] b) pure if (1)
{
}
alias foo!(int) K;
--------------------
% dmd -o- -c test
Assertion failed: (tn->mod & MODimmutable || tn->mod & MODconst), function
check, file mtype.c, line 871.
--------------------
GDB backtrace:
...
#3 0x283a2ef6 in __assert () from /lib/libc.so.7
#4 0x080fa0fe in Type::check ()
#5 0x080fa23f in Type::fixTo ()
#6 0x081001b7 in Type::constOf ()
#7 0x08136150 in TemplateDeclaration::makeParamNamesVisibleInConstraint ()
#8 0x08136415 in TemplateDeclaration::matchWithInstance ()
#9 0x08138cac in TemplateInstance::findBestMatch ()
#10 0x08139c67 in TemplateInstance::semantic ()
#11 0x0813a190 in TemplateInstance::semantic ()
#12 0x081005d3 in TypeInstance::resolve ()
...
The assertion does not fail in the following cases:
--------------------
void bar(T)(T a, T[] b) pure { } // no constraint
void dee(T)(T a, T[] ) pure if (1) { } // array parameter is unnamed
void mew(T)(T a, T[] b) if (1) { } // impure
alias bar!(int) L; // okay
alias dee!(int) M; // okay
alias mew!(int) N; // okay
--------------------
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list