www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12197] New: 'invalid array operation' errror message with valid array operation

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12197

           Summary: 'invalid array operation' errror message with valid
                    array operation
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12197


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com
           Platform|x86                         |All
         OS/Version|Windows                     |All
           Severity|minor                       |regression



I'm guessing this was caused by
https://github.com/D-Programming-Language/dmd/pull/2891

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 19 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12197


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com



01:16:38 EET ---

 I'm guessing this was caused by
 https://github.com/D-Programming-Language/dmd/pull/2891
Indeed, confirmed by bisecting. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12197




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.
.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12197


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2014