summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/conditional-expr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-26 20:59:55 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-26 20:59:55 +0000
commitf9edf80c39cec48906529ca168bc155cd8a0367b (patch)
treea4a2d8f6e62f0a4f980295463436b4f032c18f00 /clang/test/SemaCXX/conditional-expr.cpp
parent34147278eafdd7f42ac06637c7168af221379772 (diff)
downloadbcm5719-llvm-f9edf80c39cec48906529ca168bc155cd8a0367b.tar.gz
bcm5719-llvm-f9edf80c39cec48906529ca168bc155cd8a0367b.zip
When trying to determine whether one operand of a conditional
expression can be converted to the type of another, only apply the lvalue-to-rvalue conversion to the type of the expression we're converting, *not* the array-to-pointer or function-to-pointer conversions. Fixes PR6595. llvm-svn: 99652
Diffstat (limited to 'clang/test/SemaCXX/conditional-expr.cpp')
-rw-r--r--clang/test/SemaCXX/conditional-expr.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/conditional-expr.cpp b/clang/test/SemaCXX/conditional-expr.cpp
index c0c78bfb36f..e2a966bdd95 100644
--- a/clang/test/SemaCXX/conditional-expr.cpp
+++ b/clang/test/SemaCXX/conditional-expr.cpp
@@ -198,3 +198,18 @@ void test()
// *must* create a separate temporary copy of class objects. This can only
// be properly tested at runtime, though.
}
+
+namespace PR6595 {
+ struct String {
+ String(const char *);
+ operator const char*() const;
+ };
+
+ void f(bool Cond, String S) {
+ (void)(Cond? S : "");
+ (void)(Cond? "" : S);
+ const char a[1] = {'a'};
+ (void)(Cond? S : a);
+ (void)(Cond? a : S);
+ }
+}
OpenPOWER on IntegriCloud