xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/expr.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -x c++ < %s
2*f4a2713aSLionel Sambuc 
test0(int x)3*f4a2713aSLionel Sambuc void test0(int x) {
4*f4a2713aSLionel Sambuc           if (x != 0) return;
5*f4a2713aSLionel Sambuc }
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc // PR5211
test1()9*f4a2713aSLionel Sambuc void test1() {
10*f4a2713aSLionel Sambuc   char *xpto;
11*f4a2713aSLionel Sambuc   while ( true && xpto[0] );
12*f4a2713aSLionel Sambuc }
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc // PR5514
15*f4a2713aSLionel Sambuc int a;
test2()16*f4a2713aSLionel Sambuc void test2() { ++a+=10; }
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc // PR7892
19*f4a2713aSLionel Sambuc int test3(const char*);
20*f4a2713aSLionel Sambuc int test3g = test3(__PRETTY_FUNCTION__);
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // PR7889
24*f4a2713aSLionel Sambuc struct test4A {
25*f4a2713aSLionel Sambuc   int j : 2;
26*f4a2713aSLionel Sambuc };
test4()27*f4a2713aSLionel Sambuc int test4() {
28*f4a2713aSLionel Sambuc   test4A a;
29*f4a2713aSLionel Sambuc   (a.j = 2) = 3;
30*f4a2713aSLionel Sambuc }
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc // Incomplete type in conditional operator.
33*f4a2713aSLionel Sambuc // Check operations on incomplete types.
34*f4a2713aSLionel Sambuc struct s5;
f5_0(bool cond,struct s5 & a,struct s5 & b)35*f4a2713aSLionel Sambuc struct s5 &f5_0(bool cond, struct s5 &a, struct s5 &b) {
36*f4a2713aSLionel Sambuc   return cond ? a : b;
37*f4a2713aSLionel Sambuc }
38