Bug 8595 – typeof(return) inside opApply loop always int

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-28T09:08:00Z
Last change time
2012-09-06T19:31:44Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2012-08-28T09:08:52Z
Probably related to the way opApply works under the hood, as a delegate that returns int. struct OpApply { int opApply(int delegate(ref int) dg) { assert(0); } } void main() { doIt(); } string doIt() { foreach(elem; OpApply.init) { pragma(msg, typeof(return)); // int, should be string } assert(0); }
Comment #1 by k.hara.pg — 2012-08-28T10:04:28Z
Comment #2 by github-bugzilla — 2012-09-06T00:23:03Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5a8204ff2342b854367ec7b582f90a203cd47545 fix Issue 8595 - typeof(return) inside opApply loop always int https://github.com/D-Programming-Language/dmd/commit/c43d0619748bb2d28cddf2322754d66b35381e00 Merge pull request #1097 from 9rnsr/fix8595 Issue 8595 - typeof(return) inside opApply loop always int
Comment #3 by nazriel6969 — 2012-09-06T19:31:44Z
Seems to be fixed with https://github.com/D-Programming-Language/dmd/pull/1097 Test case with newest DMD trunk: http://dpaste.dzfl.pl/0a8d99b8 Closing issue if nobody minds :)