Bug 18718 – ICE in dmd/traits.d:417

Status
RESOLVED
Resolution
DUPLICATE
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-04-03T20:47:22Z
Last change time
2018-05-02T19:14:24Z
Keywords
ice, ice-on-invalid-code
Assigned to
No Owner
Creator
Seb
See also
https://issues.dlang.org/show_bug.cgi?id=17819

Comments

Comment #0 by greensunny12 — 2018-04-03T20:47:22Z
Reduced example (from https://forum.dlang.org/post/[email protected]) --- struct World { mixin BuildStuff; } template BuildStuff() { static foreach(elem; __traits(allMembers, typeof(this))) { } } --- Stacktrace: --- 0x00005555558ba0eb in semanticTraits(TraitsExp*, Scope*) (e=0x0, sc=0x0) at dmd/traits.d:417 417 extern (C++) Expression semanticTraits(TraitsExp e, Scope* sc) #0 0x00005555558ba0eb in semanticTraits(TraitsExp*, Scope*) (e=0x0, sc=0x0) at dmd/traits.d:417 #1 0x0000555555824dbd in ExpressionSemanticVisitor::visit(TraitsExp*) (this=0x7fffff7ff238, e=0x7ffff6971ad0) at dmd/expressionsem.d:3791 #2 0x0000555555812c32 in TraitsExp::accept(Visitor*) (this=0x7ffff6971ad0, v=0x7fffff7ff238) at dmd/expression.d:4743 #3 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x7ffff6971ad0, sc=0x7ffff6857e40) at dmd/expressionsem.d:9367 #4 0x000055555578ec45 in _D3dmd4cond13StaticForeach7prepareMFPSQBk6dscope5ScopeZv (this=0x7ffff69719e0, sc=0x7ffff6857e40) at dmd/cond.d:385 #5 0x0000555555787714 in StaticForeachDeclaration::include(Scope*) (this=0x7ffff6971940, sc=0x7ffff6857d10) at dmd/attrib.d:1083 #6 0x00005555557de39b in _D3dmd7dsymbol12ScopeDsymbol8_foreachFPSQBm6dscope5ScopePSQCe4root5array__T5ArrayTCQDdQDc7DsymbolZQxMDFmQwZiPmZi (pn=0x7fffff7ff3c8, dg=..., members=0x7ffff6971920, sc=0x7ffff6857d10) at dmd/dsymbol.d:1666 #7 0x00005555557de3ef in _D3dmd7dsymbol12ScopeDsymbol8_foreachFPSQBm6dscope5ScopePSQCe4root5array__T5ArrayTCQDdQDc7DsymbolZQxMDFmQwZiPmZi (pn=0x0, dg=..., members=0x7ffff7e9f500, sc=0x7ffff6857d10) at dmd/dsymbol.d:1668 #8 0x00005555558bc8c1 in semanticTraits(TraitsExp*, Scope*) (e=0x7ffff6971ad0, sc=0x7ffff6857d10) at dmd/traits.d:1335 #9 0x0000555555824dbd in ExpressionSemanticVisitor::visit(TraitsExp*) (this=0x7fffff7ffcc8, e=0x7ffff6971ad0) at dmd/expressionsem.d:3791 #10 0x0000555555812c32 in TraitsExp::accept(Visitor*) (this=0x7ffff6971ad0, v=0x7fffff7ffcc8) at dmd/expression.d:4743 #11 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x7ffff6971ad0, sc=0x7ffff6857d10) at dmd/expressionsem.d:9367 #12 0x000055555578ec45 in _D3dmd4cond13StaticForeach7prepareMFPSQBk6dscope5ScopeZv (this=0x7ffff69719e0, sc=0x7ffff6857d10) at dmd/cond.d:385 #13 0x0000555555787714 in StaticForeachDeclaration::include(Scope*) (this=0x7ffff6971940, sc=0x7ffff6857be0) at dmd/attrib.d:1083 #14 0x00005555557de39b in _D3dmd7dsymbol12ScopeDsymbol8_foreachFPSQBm6dscope5ScopePSQCe4root5array__T5ArrayTCQDdQDc7DsymbolZQxMDFmQwZiPmZi (pn=0x7fffff7ffe58, dg=..., members=0x7ffff6971920, sc=0x7ffff6857be0) at dmd/dsymbol.d:1666 #15 0x00005555557de3ef in _D3dmd7dsymbol12ScopeDsymbol8_foreachFPSQBm6dscope5ScopePSQCe4root5array__T5ArrayTCQDdQDc7DsymbolZQxMDFmQwZiPmZi (pn=0x0, dg=..., members=0x7ffff7e9f500, sc=0x7ffff6857be0) at dmd/dsymbol.d:1668 ---
Comment #1 by greensunny12 — 2018-04-04T05:11:01Z
A start - https://github.com/dlang/dmd/pull/8125 (<- needs more work)
Comment #2 by greensunny12 — 2018-04-06T02:53:58Z
Comment #3 by timon.gehr — 2018-05-02T19:14:24Z
This is the same issue as 17819, but I will add this case to the test suite too. *** This issue has been marked as a duplicate of issue 17819 ***