summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-05-16 20:37:07 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-05-16 20:37:07 +0000
commit928ab4d546ac8494041f7427534d41ddaecb2bea (patch)
treee4eb01de09d4a8e2075bcbbcba7b90542097628f
parent2e1d5e487be86bd53a845470aa7b0370feb60be2 (diff)
downloadbcm5719-llvm-928ab4d546ac8494041f7427534d41ddaecb2bea.tar.gz
bcm5719-llvm-928ab4d546ac8494041f7427534d41ddaecb2bea.zip
Sema-based fix for PR2334. The issue is that even if the two sides of
the condidtional have compatible types, they are not necessarily the same type. Therefore, we cast to the composite type. As a hack, for the moment we assume that the composite type is the type of the left-hand expression; this isn't correct, but it's good enough for most purposes. llvm-svn: 51202
-rw-r--r--clang/lib/Sema/SemaExpr.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 64b53d58848..6132dfddbac 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -920,9 +920,12 @@ inline QualType Sema::CheckConditionalOperands( // C99 6.5.15
// differently qualified versions of compatible types, the result type is
// a pointer to an appropriately qualified version of the *composite*
// type.
- // FIXME: Need to return the composite type.
+ // FIXME: Need to calculate the composite type.
// FIXME: Need to add qualifiers
- return lexT;
+ QualType compositeType = lexT;
+ ImpCastExprToType(lex, compositeType);
+ ImpCastExprToType(rex, compositeType);
+ return compositeType;
}
}
OpenPOWER on IntegriCloud