pr77285-2.C: Require tls_native support.
[gcc.git] / gcc / testsuite / g++.dg / uninit-pred-2_b.C
1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -O2" } */
3
4 typedef long long int64;
5 void incr ();
6 bool is_valid (int);
7 int get_time ();
8
9 class A
10 {
11 public:
12 A ();
13 ~A () {
14 if (I) delete I;
15 }
16
17 private:
18 int* I;
19 };
20
21 bool get_url (A *);
22
23 class M {
24
25 public:
26 __attribute__ ((always_inline)) bool GetC (int *c) {
27
28 A details_str;
29 if (get_url (&details_str))
30 {
31 *c = get_time ();
32 return true;
33 }
34
35 return false;
36 }
37
38 void do_sth();
39 void do_sth2();
40
41 void P (int64 t)
42 {
43 int cc; /* { dg-message "note: 'cc' was declared here" } */
44 if (GetC (&cc)) /* return flag checked wrongly */
45 return;
46
47 if (cc <= 0) /* { dg-warning "uninitialized" "uninitialized variable warning" } */
48 {
49 this->do_sth();
50 return;
51 }
52
53 do_sth2();
54 }
55 };
56
57 M* m;
58 void foo(int x)
59 {
60 m = new M;
61 m->P(x);
62 }