Bug 16483 – ICE in expression.d from typeof

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-09-09T16:00:28Z
Last change time
2020-03-21T03:56:40Z
Assigned to
No Owner
Creator
John Colvin

Comments

Comment #0 by john.loughran.colvin — 2016-09-09T16:00:28Z
struct S { enum a = is(typeof(false.bar!(x => x))); } auto bar(alias foo)(bool var) { return foo(var); } [email protected](10347): Assertion failure ---------------- 4 dmd 0x00000001035f36e8 _d_assert + 104 5 dmd 0x00000001033c897a void ddmd.expression.__assert(int) + 38 6 dmd 0x000000010345dc5c _ZN7CallExp8semanticEP5Scope + 13308 7 dmd 0x00000001034f0781 _ZN24StatementSemanticVisitor5visitEP15ReturnStatement + 1321 8 dmd 0x00000001034dda34 _ZN15ReturnStatement6acceptEP7Visitor + 28 9 dmd 0x00000001034f3fca ddmd.statement.Statement ddmd.statementsem.semantic(ddmd.statement.Statement, ddmd.dscope.Scope*) + 66 10 dmd 0x00000001034e6ba5 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement + 237 11 dmd 0x00000001034dc1a9 _ZN17CompoundStatement6acceptEP7Visitor + 25 12 dmd 0x00000001034f3fca ddmd.statement.Statement ddmd.statementsem.semantic(ddmd.statement.Statement, ddmd.dscope.Scope*) + 66 13 dmd 0x00000001034725de _ZN15FuncDeclaration9semantic3EP5Scope + 4614 14 dmd 0x0000000103475031 _ZN15FuncDeclaration17functionSemantic3Ev + 113 15 dmd 0x0000000103474eb2 _ZN15FuncDeclaration16functionSemanticEv + 266 16 dmd 0x000000010344b4d2 _ZN10DsymbolExp7resolveE3LocP5ScopeP7Dsymbolb + 1274 17 dmd 0x000000010344f64b _ZN8ScopeExp8semanticEP5Scope + 1675 18 dmd 0x000000010345ad4e _ZN7CallExp8semanticEP5Scope + 1262 19 dmd 0x0000000103443dba _Z21resolveUFCSPropertiesP5ScopeP10ExpressionS2_ + 746 20 dmd 0x0000000103459359 _ZN22DotTemplateInstanceExp8semanticEP5Scope + 49 21 dmd 0x00000001034b2b24 _ZN10TypeTypeof7resolveE3LocP5ScopePP10ExpressionPP4TypePP7Dsymbolb + 196 22 dmd 0x00000001034b2e20 _ZN10TypeTypeof8semanticE3LocP5Scope + 64 23 dmd 0x00000001034a3d81 _ZN4Type11trySemanticE3LocP5Scope + 65 24 dmd 0x0000000103454005 _ZN5IsExp8semanticEP5Scope + 181 25 dmd 0x000000010348d9fd _ZN14ExpInitializer9inferTypeEP5Scope + 37 26 dmd 0x00000001033fc31d _ZN14VarDeclaration8semanticEP5Scope + 333 27 dmd 0x0000000103427225 _ZN17StructDeclaration8semanticEP5Scope + 1013 28 dmd 0x000000010341d275 _ZN6Module8semanticEP5Scope + 117 29 dmd 0x00000001034a139f int ddmd.mars.tryMain(ulong, const(char)**) + 13103 30 dmd 0x00000001033c90e2 _Dmain + 38 31 dmd 0x000000010360425f D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 39 32 dmd 0x0000000103604193 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 35 33 dmd 0x0000000103604204 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 44 34 dmd 0x0000000103604193 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 35 35 dmd 0x00000001036040f9 _d_run_main + 497 36 dmd 0x00000001033c917b main + 15 37 dmd 0x00000001033c7723 start + 51 38 ??? 0x0000000000000001 0x0 + 1 could be related to https://issues.dlang.org/show_bug.cgi?id=16481 as it's an alternative reduction from the same codebase.
Comment #1 by b2.temp — 2017-01-15T21:56:55Z
As a workaround it's possible to mark the free function as "static". There's a more interesting error message with this similar example: struct S { enum a = bar!(x=>x)(true); } /*static*/ bool bar(alias foo)(bool b) { return foo(b); }
Comment #2 by bitter.taste — 2017-01-15T23:14:39Z
Comment #3 by github-bugzilla — 2017-01-26T21:03:08Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/3f94ea1ecba10d663faca0d4bc814057e40dbd70 Fix issue 16483 - Prevent an ICE with lambdas as template parameter https://github.com/dlang/dmd/commit/254c25928bb5dc64fad12fbf5731db9864e5a8b7 Merge pull request #6451 from LemonBoy/b16483 Fix issue 16483 - Prevent an ICE with lambdas as template parameter
Comment #4 by github-bugzilla — 2017-02-24T20:34:18Z
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/3f94ea1ecba10d663faca0d4bc814057e40dbd70 Fix issue 16483 - Prevent an ICE with lambdas as template parameter https://github.com/dlang/dmd/commit/254c25928bb5dc64fad12fbf5731db9864e5a8b7 Merge pull request #6451 from LemonBoy/b16483
Comment #5 by github-bugzilla — 2017-03-22T12:21:16Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/3f94ea1ecba10d663faca0d4bc814057e40dbd70 Fix issue 16483 - Prevent an ICE with lambdas as template parameter https://github.com/dlang/dmd/commit/254c25928bb5dc64fad12fbf5731db9864e5a8b7 Merge pull request #6451 from LemonBoy/b16483