Bug 12197 – 'invalid array operation' errror message with valid array operation

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-18T13:36:00Z
Last change time
2014-02-20T10:46:52Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-02-18T13:36:47Z
void foo(T)(T[1] b) { b[] = b[] ^^ 2; } void main() { import std.stdio; foo([10]); } DMD 2.065rc1 gives: test.d(2,9): Error: invalid array operation 'b[] = b[] ^^ 2' for element type int test.d(6,8): Error: template instance test.foo!int error instantiating Expected error message: test.d(2,11): Error: must import std.math to use ^^ operator
Comment #1 by yebblies — 2014-02-19T02:29:15Z
Comment #2 by dlang-bugzilla — 2014-02-19T15:16:38Z
(In reply to comment #1) > I'm guessing this was caused by > https://github.com/D-Programming-Language/dmd/pull/2891 Indeed, confirmed by bisecting.
Comment #3 by github-bugzilla — 2014-02-20T04:42:41Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0ccbc134da6c44b3ae922992d911d8a9dfdaa3c3 fix Issue 12197 - 'invalid array operation' errror message with valid array operation Make explicit importing std.math unnecessary for pow expressions. Currently front-end does not enforce std.math module existence. Therefore, there's not also necessity to explicitly import std.math in user code. .