Bug 18994 – Use noncopyable variable in foreach loop without ref results in error message without line number

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-06-15T17:10:23Z
Last change time
2018-06-17T11:08:48Z
Assigned to
No Owner
Creator
Yuxuan Shui

Comments

Comment #0 by yshuiv7 — 2018-06-15T17:10:23Z
struct Type2 { int opApply(int delegate(ref Type1)) { return 0; } } struct Type1 { @disable this(this); } void test() { foreach(b; Type2()) {} } This could even crash the compiler when -dip1000 is used.
Comment #1 by github-bugzilla — 2018-06-17T11:08:47Z
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/42f7252a19640f276e046e8fd264d4484eb82619 fix issue 18994 - Use noncopyable variable in foreach loop without ref results in error message without line number Set loc for the copy expression generated by the compiler too.