www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11970] New: Self-assigned variable expression with no effect doesn't have compiler error

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

           Summary: Self-assigned variable expression with no effect
                    doesn't have compiler error
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ilya-stromberg-2009 yandex.ru


--- Comment #0 from ilya-stromberg <ilya-stromberg-2009 yandex.ru> 2014-01-22
08:23:44 PST ---
Reduced example:

void main()
{
    int i;
    i = i;
}

The code `i = i;` does nothing, but there are no compiler error.

This error in real life:
https://github.com/rejectedsoftware/vibe.d/issues/406

Note that we already have errors for no effect expression, for example for this
code: `int i; i;` - `Error: var has no effect in expression (i)`.

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


bearophile_hugs eml.cc changed:

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


--- Comment #1 from bearophile_hugs eml.cc 2014-01-22 09:53:04 PST ---
Voted +1.

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com
           Severity|normal                      |enhancement


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