Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wdangling-pointer-3.C
blob64117bfb65a5e33edc5ea374f466394f3c0051a7
1 /* PR middle-end/104076 - bogus -Wdangling-pointer on a conditional expression
2    { dg-do compile { target { c++11 } } }
3    { dg-options "-Wall" } */
5 namespace std {
7 template <class T>
8 struct initializer_list
10   T *array;
11   __SIZE_TYPE__ nelts;
13   initializer_list (const T *a, __SIZE_TYPE__ n)
14     : array (a), nelts (n) { }
16   initializer_list()
17   : array (), nelts () { }
19   T* begin () const { return array; }
21   const T* end () const { return array + nelts; }
26 struct S1
28   S1 (int);
29   ~S1 ();
32 struct S2 { S2 (std::initializer_list<S1>); };
34 S2 f1();
36 S2 f2(bool b)
38   return b ? f1() : S2{0};    // { dg-bogus "-Wdangling-pointer" }