PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / uninit-pred-1_a.C
blob58bb9c5d45af69b60d27d9434225e21e33cadc77
1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -O2" } */
4 typedef long long int64;
5 void incr ();
6 bool is_valid (int);
7 int  get_time ();
9 class A 
11 public:
12   A ();
13   ~A () {
14     if (I) delete I;
15   }
17 private:
18   int* I;
21 bool get_url (A *);
23 class M {
25  public:
26 __attribute__ ((always_inline))  int GetC (int *c)  {
28     A details_str;
29     if (!get_url (&details_str))
30       {
31         incr ();
32         return 1;
33       }
35     *c = get_time ();
36     return -1;
37   }
39   void do_sth();
40   void do_sth2();
41    
42   void P (int64 t)
43     {
44       int cc; /* { dg-bogus "uninitialized" "uninitialized variable warning" }  */ 
45       if (GetC (&cc) >= 0 )
46         return;
47       
48       if (t && cc <= 0 )  /* { dg-bogus "uninitialized" "uninitialized variable warning" } */
49         {
50           this->do_sth();
51           return;
52         }
54     do_sth2();
55   }
58 M* m; 
59 void foo(int x)
61   m = new M;
62   m->P(x);