www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4163] New: if(bool = bool) results in ill-worded error

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

           Summary: if(bool = bool) results in ill-worded error
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: schveiguy yahoo.com



10:42:33 PDT ---
The following code:

bool x, y;
if(x = y) {}

results in the following error:

Error: '=' does not give a boolean result

Which is clearly not a correct message.  A better message would be something
like:

Error: '=' cannot be used inside an if condition

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


bearophile_hugs eml.cc changed:

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



Be careful with the wording, because this is allowed in D:
if(bool c = !b)

Writing a compiler requires literary expression skills :-)

A possible error message, that looks too much complex:
Error: if(x = y) is now allowed, use if(T x = y) or if((x = y) == z).

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 2532 ***

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