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: nob...@puremagic.com
        ReportedBy: rsi...@gmail.com


--- Comment #0 from Shin Fujishiro <rsi...@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: -------

Reply via email to