www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9398] New: strange error message "incompatible types for ..." for temary operator

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

           Summary: strange error message "incompatible types for ..." for
                    temary operator
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kekeniro2 yahoo.co.jp



Error message showing type mismatch for 
 (a ? b : c)
is printed below:
 Error: incompatible types for ((b) ? (c)): 'B' and 'C'

Wrong '?' position.

It shoud be ... ((a) ? (b) : (c)): 'B' and 'C'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 25 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |andrej.mitrovich gmail.com
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com



12:57:32 PST ---
https://github.com/D-Programming-Language/dmd/pull/1555

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|strange error message       |Wrong diagnostic for
                   |"incompatible types for     |ternary operator type
                   |..." for temary operator    |mismatch



13:00:58 PST ---

 It should be ... ((a) ? (b) : (c)): 'B' and 'C'
Nope, it should be:
 ((b) : (c)): 'B' and 'C'
Otherwise you can't determine what position 'B' and 'C' are in because the ternary expression could be quite complex, e.g.:
 ((a) ? (a) : (b) ? (b) : (c)): 'int' and 'float'
-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bba09e60fa4cbb59c84fc125d4ca58a4eb231578
Fixes Issue 9398 - Print colon instead of question mark for mismatch of ternary
operator types.

https://github.com/D-Programming-Language/dmd/commit/57a0ea9bd6035b12603ed9e99f67f7c5b7b00679


Issue 9398 - Print colon for mismatch of ternary operator types

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 27 2013