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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to