www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21765] New: Assignment-as-condition error with

https://issues.dlang.org/show_bug.cgi?id=21765

          Issue ID: 21765
           Summary: Assignment-as-condition error with checkaction=context
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

-------------------------------
ref int boo();

void main()
{
    assert((  boo() = 2) == 2);
}
-------------------------------

Only with -checkaction=context:

checkaction.d(5): Error: assignment cannot be used as a condition, perhaps `==`
was meant?

--
Mar 24 2021