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


--- Comment #0 from Steven Schveighoffer <schveiguy yahoo.com> 2010-05-07
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


--- Comment #1 from bearophile_hugs eml.cc 2010-05-08 04:42:46 PDT ---
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


--- Comment #2 from yebblies <yebblies gmail.com> 2011-06-13 09:01:42 PDT ---
*** 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