summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-12 00:15:05 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-12 00:15:05 +0000
commit78ca74d81d9351e54677810ccbbedc6f0cfc4387 (patch)
tree77ba24717c60f71f1664062806f6e9b9524761d4 /clang/lib/Sema/SemaExprCXX.cpp
parentf6d609a22722fb47389b5da80b5d84a8cace6d4f (diff)
downloadbcm5719-llvm-78ca74d81d9351e54677810ccbbedc6f0cfc4387.tar.gz
bcm5719-llvm-78ca74d81d9351e54677810ccbbedc6f0cfc4387.zip
Introduce _Complex conversions into the function overloading
system. Since C99 doesn't have overloading and C++ doesn't have _Complex, there is no specification for this. Here's what I think makes sense. Complex conversions come in several flavors: - Complex promotions: a complex -> complex conversion where the underlying real-type conversion is a floating-point promotion. GCC seems to call this a promotion, EDG does something else. This is given "promotion" rank for determining the best viable function. - Complex conversions: a complex -> complex conversion that is not a complex promotion. This is given "conversion" rank for determining the best viable function. - Complex-real conversions: a real -> complex or complex -> real conversion. This is given "conversion" rank for determining the best viable function. These rules are the same for C99 (when using the "overloadable" attribute) and C++. However, there is one difference in the handling of floating-point promotions: in C99, float -> long double and double -> long double are considered promotions (so we give them "promotion" rank), while C++ considers these conversions ("conversion" rank). llvm-svn: 64343
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 6ce83315553..9f494d98593 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -806,9 +806,12 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
case ICK_Integral_Promotion:
case ICK_Floating_Promotion:
+ case ICK_Complex_Promotion:
case ICK_Integral_Conversion:
case ICK_Floating_Conversion:
+ case ICK_Complex_Conversion:
case ICK_Floating_Integral:
+ case ICK_Complex_Real:
case ICK_Compatible_Conversion:
// FIXME: Go deeper to get the unqualified type!
FromType = ToType.getUnqualifiedType();
OpenPOWER on IntegriCloud