PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / g++.dg / uninit-pred-3_a.C
blob91014079004e7f246bccfc3bf871eb71d84fc3ee
1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -O2" } */
4 /* Multiple initialization paths.  */
6 typedef long long int64;
7 void incr ();
8 bool is_valid (int);
9 int  get_time ();
11 class A
13 public:
14   A ();
15   ~A () {
16     if (I) delete I;
17   }
19 private:
20   int* I;
23 bool get_url (A *);
24 bool get_url2 (A *);
26 class M {
28  public:
29  __attribute__ ((always_inline))
30  bool GetC (int *c)  {
32     A details_str;
33     /* Intialization path 1  */
34     if (get_url (&details_str))
35       {
36         *c = get_time ();
37         return true;
38       }
40     /* insert dtor calls (inlined) into following return paths  */
41     A tmp_str;
43     /* Intializtion path 2  */
44     if (get_url2 (&details_str))
45       {
46         *c = get_time ();
47         return true;
48       }
50     return false;
51   }
53   void do_sth();
54   void do_sth2();
56   void P (int64 t)
57     {
58       int cc;
59       if (!GetC (&cc)) /* return flag checked properly */
60         return;
62       if (cc <= 0)   /* { dg-bogus "uninitialized" "uninitialized variable warning" } */
63         {
64           this->do_sth();
65           return;
66         }
68     do_sth2();
69   }
72 M* m;
73 void test(int x)
75   m = new M;
76   m->P(x);