Bug 7812 – Segfault on invalid code during template match deduction with errors gagged
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-02T09:38:00Z
Last change time
2012-04-05T13:30:59Z
Keywords
ice, pull
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2012-04-02T09:38:24Z
The following snippet compiles fine using 2.058, but segfaults with latest Git master (c2824d43):
---
template A(T...) {
}
template B(alias C) if (C) {
}
template D() {
alias B!(A!(NonExistent!())) D;
}
static assert(!__traits(compiles, D!()));
---
---
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x000cf64d in DsymbolExp::semantic (this=0x4631e0, sc=0x462c30) at expression.c:2920
2920 s = ti->inst->toAlias();
(gdb) bt
#0 0x000cf64d in DsymbolExp::semantic (this=0x4631e0, sc=0x462c30) at expression.c:2920
#1 0x000cde68 in IdentifierExp::semantic (this=0x4631c0, sc=0x462c30) at expression.c:2635
#2 0x001c43c9 in TemplateDeclaration::matchWithInstance (this=0x426ab0, ti=0x462010, dedtypes=0xbfffec88, fargs=0x0, flag=0) at template.c:790
#3 0x001d1208 in TemplateInstance::findBestMatch (this=0x462010, sc=0x461d50, fargs=0x0) at template.c:5152
#4 0x001c88f1 in TemplateInstance::semantic (this=0x462010, sc=0x461d50, fargs=0x0) at template.c:4468
#5 0x001d07a4 in TemplateInstance::semantic (this=0x462010, sc=0x461d50) at template.c:4321
#6 0x00166845 in TypeInstance::resolve (this=0x461fb0, loc={filename = 0x426710 "test.d", linnum= 8}, sc=0x461d50, pe=0xbfffef18, pt=0xbfffef1c, ps=0xbfffef14) at mtype.c:6690
#7 0x00166bcc in TypeInstance::toDsymbol (this=0x461fb0, sc=0x461d50) at mtype.c:6745
#8 0x00092118 in AliasDeclaration::semantic (this=0x461f50, sc=0x461d50) at declaration.c:461
#9 0x001d086a in TemplateInstance::expandMembers (this=0x4271a0, sc2=0x461d50) at template.c:4338
#10 0x001d090e in TemplateInstance::tryExpandMembers (this=0x4271a0, sc2=0x461d50) at template.c:4374
#11 0x001c9265 in TemplateInstance::semantic (this=0x4271a0, sc=0x461bb0, fargs=0x0) at template.c:4736
#12 0x001d07a4 in TemplateInstance::semantic (this=0x4271a0, sc=0x461bb0) at template.c:4321
#13 0x00166845 in TypeInstance::resolve (this=0x427250, loc={filename = 0x426710 "test.d", linnum = 11}, sc=0x461bb0, pe=0xbffff44c, pt=0xbffff43c, ps=0xbffff438) at mtype.c:6690
#14 0x00214d1f in TraitsExp::semantic (this=0x4272b0, sc=0x461bb0) at traits.c:462
#15 0x000db61d in UnaExp::semantic (this=0x4272d0, sc=0x461bb0) at expression.c:5828
#16 0x000e85c3 in NotExp::semantic (this=0x4272d0, sc=0x461bb0) at expression.c:8503
#17 0x001e5af7 in StaticAssert::semantic2 (this=0x4272f0, sc=0x461bb0) at staticassert.c:59
#18 0x0014e187 in Module::semantic2 (this=0x4265f0) at module.c:840
#19 0x0014a553 in tryMain (argc=5, argv=0x41fea0) at mars.c:1301
#20 0x0014b282 in main (argc=2, argv=0xbffffbd8) at mars.c:1476
---
This has likely been uncovered by the change from issue 7481.