[Issue 7859] New: Crash on invalid alias template parameter type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 8 11:59:05 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7859

           Summary: Crash on invalid alias template parameter type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at klickverbot.at


--- Comment #0 from klickverbot <code at klickverbot.at> 2012-04-08 11:59:45 PDT ---
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
---

-- 
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