Bug 10133 – ICE for templated static conditional lambda

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-21T22:42:00Z
Last change time
2014-08-22T05:03:32Z
Keywords
ice, pull
Assigned to
nobody
Creator
daniel350

Comments

Comment #0 by daniel350 — 2013-05-21T22:42:08Z
import std.algorithm; bool func(string s)() if (countUntil!(x => x == 'x')(s)) { return true; } void main() { func!("x")(); } ------------ The above code produces `dmd: mangle.c:100: char* mangle(Declaration*, bool): Assertion `fd && fd->inferRetType' failed.`
Comment #1 by yebblies — 2013-11-21T07:40:49Z
Gives: DMD v2.065 DEBUG testx.d(8): Error: template instance func!"x" does not match template declaratio n func(string s)() if (countUntil!((x) => x == 'x')(s)) import std.algorithm; bool func(string s)() if (countUntil!(x => x == 'x')(s)) { return true; } void main() { func!("ax")(); } gives a new ice: assert glue.c(596) ident != Id::empty
Comment #2 by k.hara.pg — 2014-01-15T06:23:10Z
Comment #3 by github-bugzilla — 2014-01-23T23:22:06Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/cc00939d9db688605fa52b602c9e9997b18da94c fix Issue 10133 - ICE for templated static conditional lambda https://github.com/D-Programming-Language/dmd/commit/2211c8e5b1c7cfb589cec400a959cc672ca92083 Merge pull request #3103 from 9rnsr/fix10133 Issue 10133 - ICE for templated static conditional lambda
Comment #4 by github-bugzilla — 2014-01-27T16:49:33Z
Commit pushed to 2.065 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9696390244e466b0dd460cda9b0ea0ee55aedf2a Merge pull request #3103 from 9rnsr/fix10133 Issue 10133 - ICE for templated static conditional lambda
Comment #5 by github-bugzilla — 2014-01-27T19:24:21Z
Commit pushed to 2.065 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e9280781bd3831de9504f56a8cba5965b9335a0a Merge pull request #3103 from 9rnsr/fix10133 Issue 10133 - ICE for templated static conditional lambda
Comment #6 by k.hara.pg — 2014-03-13T18:42:44Z
Fixed in 2.065.
Comment #7 by github-bugzilla — 2014-08-22T05:03:32Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9202b529b329ce0087ae976aa8bf1deadd1b62de Distinguish speculative instantiation from gagged one to elide unnecessary symbol emission Template constraint evaluation may instantiate exactly same symbols multiple times (eg. issue 10133 test case in test/runnable/funclit.d). It would cause linker error "duplicate COMDAT" in Win64. To avoid the issue, dmd should elide unnecessary symbol emission. If a template is instantiated in template constraint or static condition, it's marked as speculative instantiation. If no other code at non-speculative context refer the instance, compiler will elide its code generation.