]> granicus.if.org Git - clang/commit
[complex] Teach the other two binary operators on complex numbers (==
authorChandler Carruth <chandlerc@gmail.com>
Sat, 11 Oct 2014 11:03:30 +0000 (11:03 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 11 Oct 2014 11:03:30 +0000 (11:03 +0000)
commit2dfe53a6603d3b4d7799368c97b0c19053030581
tree4634ff7c98bcfa466478a489ccef0a1e1ee72e18
parent5d697e859aa4711d270f5c3170449fcce1fbc412
[complex] Teach the other two binary operators on complex numbers (==
and !=) to support mixed complex and real operand types.

This requires removing an assert from SemaChecking, and adding support
both to the constant evaluator and the code generator to synthesize the
imaginary part when needed. This seemed somewhat cleaner than having
just the comparison operators force real-to-complex conversions.

I've added test cases for these operations. I'm really terrified that
there were *no* tests in-tree which exercised this.

This turned up when trying to build R after my change to the complex
type lowering.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219570 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/ExprConstant.cpp
lib/CodeGen/CGExprScalar.cpp
lib/Sema/SemaChecking.cpp
test/CodeGen/complex-math.c
test/SemaCXX/complex-folding.cpp