summaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/conditional-expr-lvalue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGenCXX/conditional-expr-lvalue.cpp')
-rw-r--r--clang/test/CodeGenCXX/conditional-expr-lvalue.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/conditional-expr-lvalue.cpp b/clang/test/CodeGenCXX/conditional-expr-lvalue.cpp
new file mode 100644
index 0000000..96aa8b0
--- /dev/null
+++ b/clang/test/CodeGenCXX/conditional-expr-lvalue.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -emit-llvm-only %s
+void f(bool flag) {
+ int a = 1;
+ int b = 2;
+
+ (flag ? a : b) = 3;
+}
+
+// PR10756
+namespace test0 {
+ struct A {
+ A(const A &);
+ A &operator=(const A &);
+ A sub() const;
+ void foo() const;
+ };
+ void foo(bool cond, const A &a) {
+ (cond ? a : a.sub()).foo();
+ }
+}