aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/uninit-pr105646.C
blob: 48ceb986ec66557a79a118d1e964925bbd5d7fd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// { dg-do compile }
// { dg-require-effective-target c++11 }
// { dg-options "-O2 -Wuninitialized" }

int f1();
int f2(){
    bool v2{v2}; // { dg-warning "is used uninitialized" }
    auto const & a = f1();
    return a;
}
int f3(){
    auto const & a = f1();
    // Diagnose the following when optimizing and as unconditional
    // uninitialized use despite f1 possibly throwing
    bool v3{v3}; // { dg-warning "is used uninitialized" }
    return a;
}