[LLVMbugs] [Bug 21286] New: Diagnostic when incompatible operand types are passed to the ternary operator

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 15 09:48:20 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21286

            Bug ID: 21286
           Summary: Diagnostic when incompatible operand types are passed
                    to the ternary operator
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The current error: "incompatible operand types" could be improved to say what
it is actually wrong when the ternary operator is involved. Example:

struct A{};
int main() {
  A a{};
  bool b = 2;
  3 > b ? a : b = 100;
  return 0;
}

error: incompatible operand types ('A' and 'bool')
  3 > b ? a : b = 100;
        ^ ~   ~~~~~~~
1 error generated.

This error message can include a note saying that the operands of the
conditional expression must be convertible to a common type or have the same
type.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141015/fc565a1f/attachment.html>


More information about the llvm-bugs mailing list