www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10214] New: Incorrect "element-wise assignment is better" warning

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

           Summary: Incorrect "element-wise assignment is better" warning
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com



20:08:27 MSD ---
---
void main()
{
    bool[1] arr;
    arr = 0; // line 4
}
---

dmd output:
---
main.d(4): Warning: explicit element-wise assignment (arr)[] = (0)[] is better
than arr = 0
---
(it should be no slice after `0`)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 30 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10214


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



14:13:36 PDT ---
The compiler code:

-----
if (e2->op == TOKslice || t2->implicitConvTo(t1->nextOf()))
    warning("explicit element-wise assignment (%s)[] = %s is better than %s =
%s",
        e1str, e2str, e1str, e2str);
else
    warning("explicit element-wise assignment (%s)[] = (%s)[] is better than %s
= %s",
        e1str, e2str, e1str, e2str);

-----

It almost seems like the two warnings should be swapped around?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10214


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, pull



https://github.com/D-Programming-Language/dmd/pull/2103

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10214


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc




 https://github.com/D-Programming-Language/dmd/pull/2103
A quick 1-char patch :-) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10214


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei erdani.com
         Resolution|                            |FIXED



Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/82167d3451694612fdf2d7233f3ce60eb17e2a0a
fix Issue 10214 - Incorrect "element-wise assignment is better" warning

https://github.com/D-Programming-Language/dmd/commit/1bc83060e2b735c2f1e6bb0cba810829289c1ac1


Issue 10214 - Incorrect "element-wise assignment is better" warning

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10214




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/82167d3451694612fdf2d7233f3ce60eb17e2a0a
fix Issue 10214 - Incorrect "element-wise assignment is better" warning

https://github.com/D-Programming-Language/dmd/commit/1bc83060e2b735c2f1e6bb0cba810829289c1ac1


Issue 10214 - Incorrect "element-wise assignment is better" warning

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10214


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei erdani.com
         Resolution|                            |FIXED



Commit pushed to 2.063 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/289701cad5bdece3920ff57e97b4b798d76e8d87


Issue 10214 - Incorrect "element-wise assignment is better" warning

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 01 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10214




Commit pushed to 2.063 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/289701cad5bdece3920ff57e97b4b798d76e8d87


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 01 2013