summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-12 00:26:06 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-12 00:26:06 +0000
commit6752502b81367869062655406908d30653813f2a (patch)
tree562efab9b3f21a6d3942fd120ae64a6167b30600 /clang/lib/Sema/SemaOverload.cpp
parent78ca74d81d9351e54677810ccbbedc6f0cfc4387 (diff)
downloadbcm5719-llvm-6752502b81367869062655406908d30653813f2a.tar.gz
bcm5719-llvm-6752502b81367869062655406908d30653813f2a.zip
Expand the definition of a complex promotion to include complex ->
complex conversions where the conversion between the real types is an integral promotion. This is how G++ handles complex promotions for its complex integer extension. llvm-svn: 64344
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 48d31056a79..c96fec70bbb 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -738,7 +738,9 @@ bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
// the bit-field is larger yet, no integral promotion applies to
// it. If the bit-field has an enumerated type, it is treated as any
// other value of that type for promotion purposes (C++ 4.5p3).
- if (MemberExpr *MemRef = dyn_cast<MemberExpr>(From)) {
+ // FIXME: We should delay checking of bit-fields until we actually
+ // perform the conversion.
+ if (MemberExpr *MemRef = dyn_cast_or_null<MemberExpr>(From)) {
using llvm::APSInt;
if (FieldDecl *MemberDecl = dyn_cast<FieldDecl>(MemRef->getMemberDecl())) {
APSInt BitWidth;
@@ -803,7 +805,7 @@ bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType)
///
/// A complex promotion is defined as a complex -> complex conversion
/// where the conversion between the underlying real types is a
-/// floating-point conversion.
+/// floating-point or integral promotion.
bool Sema::IsComplexPromotion(QualType FromType, QualType ToType) {
const ComplexType *FromComplex = FromType->getAsComplexType();
if (!FromComplex)
@@ -814,7 +816,9 @@ bool Sema::IsComplexPromotion(QualType FromType, QualType ToType) {
return false;
return IsFloatingPointPromotion(FromComplex->getElementType(),
- ToComplex->getElementType());
+ ToComplex->getElementType()) ||
+ IsIntegralPromotion(0, FromComplex->getElementType(),
+ ToComplex->getElementType());
}
/// BuildSimilarlyQualifiedPointerType - In a pointer conversion from
OpenPOWER on IntegriCloud