xref: /llvm-project/clang/test/CodeGenCXX/conditional-expr-lvalue.cpp (revision 46759f4f46e51976ba459b18d163b8e1e354665f)
18fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -emit-llvm-only %s
f(bool flag)2160e635bSAnders Carlsson void f(bool flag) {
3160e635bSAnders Carlsson   int a = 1;
4160e635bSAnders Carlsson   int b = 2;
5160e635bSAnders Carlsson 
6160e635bSAnders Carlsson   (flag ? a : b) = 3;
7160e635bSAnders Carlsson }
8*46759f4fSJohn McCall 
9*46759f4fSJohn McCall // PR10756
10*46759f4fSJohn McCall namespace test0 {
11*46759f4fSJohn McCall   struct A {
12*46759f4fSJohn McCall     A(const A &);
13*46759f4fSJohn McCall     A &operator=(const A &);
14*46759f4fSJohn McCall     A sub() const;
15*46759f4fSJohn McCall     void foo() const;
16*46759f4fSJohn McCall   };
foo(bool cond,const A & a)17*46759f4fSJohn McCall   void foo(bool cond, const A &a) {
18*46759f4fSJohn McCall     (cond ? a : a.sub()).foo();
19*46759f4fSJohn McCall   }
20*46759f4fSJohn McCall }
21