digitalmars.D.bugs - [Issue 4366] New: ICE(mtype.c) constrained template pure function with array/pointer parameter
- d-bugmail puremagic.com (53/53) Jun 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4366
- d-bugmail puremagic.com (17/17) Jun 24 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4366
- d-bugmail puremagic.com (12/12) Nov 07 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4366
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 puremagic.com
ReportedBy: rsinfu gmail.com
---
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:
...
...
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: -------
Jun 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4366
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug yahoo.com.au
The ICE occurs during the call in these lines in template.c,
makeParamNamesVisibleInConstraint().
if (fd->type && fd->isPure())
vtype = vtype->addMod(MODconst);
Removing those lines allows the code to compile, and the DMD test suite still
passes. So why are they there? I wrote the makeParamNamesVisibleInConstraint()
function, but I just copied those lines from func.c, where interestingly they
don't cause any problems. Still need to work out what the difference is.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4366
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla digitalmars.com
Resolution| |DUPLICATE
12:25:27 PST ---
*** This issue has been marked as a duplicate of issue 4434 ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 07 2010









d-bugmail puremagic.com 