Bug 7859 – Crash on invalid alias template parameter type
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-08T11:59:00Z
Last change time
2012-04-08T17:53:55Z
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2012-04-08T11:59:45Z
Consider the following (invalid) snippet:
---
template A(alias B) {}
mixin template C(alias B = cast(NonExistent)null) {
alias A!B D;
}
mixin C!();
---
DMD 2.058 just gave an error message, DMD 2.059 Git (5e7362a) prints the error message as well, but then crashes:
---
(gdb) r
test.d(3): Error: undefined identifier NonExistent
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff83eb04f0 in strlen ()
(gdb) bt
#0 0x00007fff83eb04f0 in strlen ()
#1 0x00000001001a76d8 in OutBuffer::writestring (this=0x7fff5fbfef18, string=0x0) at root.c:1603
#2 0x00000001001d7b3a in TemplateInstance::genIdent (this=0x100580160, args=0x100580260) at template.c:5401
#3 0x00000001001e55c5 in TemplateInstance::semantic (this=0x100580160, sc=0x100580be0, fargs=0x0) at template.c:4585
#4 0x00000001001d42c7 in TemplateInstance::semantic (this=0x100580160, sc=0x100580be0) at template.c:4323
#5 0x0000000100170519 in TypeInstance::resolve (this=0x100580340, loc={filename = 0x10051d470 "test.d", linnum = 4}, sc=0x100580be0, pe=0x7fff5fbff248, pt=0x7fff5fbff250, ps=0x7fff5fbff240) at mtype.c:6693
#6 0x0000000100170479 in TypeInstance::toDsymbol (this=0x100580340, sc=0x100580be0) at mtype.c:6748
#7 0x0000000100089b0d in AliasDeclaration::semantic (this=0x1005803f0, sc=0x100580be0) at declaration.c:461
#8 0x00000001001d5639 in TemplateMixin::semantic (this=0x10051dfa0, sc=0x10051e280) at template.c:6112
#9 0x0000000100155667 in Module::semantic (this=0x10051d260) at module.c:806
#10 0x0000000100152da9 in tryMain (argc=5, argv=0x100514180) at mars.c:1287
#11 0x0000000100153837 in main (argc=2, argv=0x7fff5fbffb50) at mars.c:1476
---
Comment #1 by github-bugzilla — 2012-04-08T12:56:43Z