www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5181] New: Excess cast on in-place operation op= involving conversion

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

           Summary: Excess cast on in-place operation op= involving
                    conversion
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: rsinfu gmail.com


--- Comment #0 from Shin Fujishiro <rsinfu gmail.com> 2010-11-06 13:39:41 PDT
---
For example, int *= double fails if the type of its result is inferred (auto,
typeof etc.):
----------
void main()
{
    int var;
    auto res = (var *= 1.5);    // (4)
}
----------
% dmd -o- -c test.d
test.d(4): Error: cast(double)var is not an lvalue
test.d(4): Error: cannot implicitly convert expression (cast(double)var *= 1.5)
of type double to int
----------
The same error occurs with addition +=, subtraction -= and division /=.

Besides, modulus %= works fine:
----------
void main()
{
    int var;
    auto res = (var %= 1.5);    // okay
}
----------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 06 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5181


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |yebblies gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2012-02-05 14:30:43 EST ---
https://github.com/D-Programming-Language/dmd/pull/695

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5181


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|D2                          |D1
         AssignedTo|yebblies gmail.com          |nobody puremagic.com
            Summary|Excess cast on in-place     |(D1 only) Excess cast on
                   |operation op= involving     |in-place operation op=
                   |conversion                  |involving conversion


--- Comment #2 from yebblies <yebblies gmail.com> 2012-02-20 18:54:21 EST ---
Fixed D2:
https://github.com/D-Programming-Language/dmd/commit/34cb3dec9de6c1c01850447c29fc2bc81d386382

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



--- Comment #3 from github-bugzilla puremagic.com 2012-02-20 00:43:37 PST ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4b3db308691690261d8a27a15bd6537d0567ecc1
fix Issue 5181 - Excess cast on in-place operation op= involving conversion

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


yebblies <yebblies gmail.com> changed:

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


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