diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 1 | ||||
| -rw-r--r-- | clang/test/SemaCXX/uninitialized.cpp | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index abbf4b2bb24..9203df3fe5b 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -8348,6 +8348,7 @@ namespace { } if (ConditionalOperator *CO = dyn_cast<ConditionalOperator>(E)) { + Visit(CO->getCond()); HandleValue(CO->getTrueExpr()); HandleValue(CO->getFalseExpr()); return; diff --git a/clang/test/SemaCXX/uninitialized.cpp b/clang/test/SemaCXX/uninitialized.cpp index d6331965ab4..a7997e4268c 100644 --- a/clang/test/SemaCXX/uninitialized.cpp +++ b/clang/test/SemaCXX/uninitialized.cpp @@ -50,6 +50,7 @@ int x = x++; // expected-warning {{variable 'x' is uninitialized when used withi int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning {{variable 'y' is uninitialized when used within its own initialization}} int z = ++ref(z); // expected-warning {{variable 'z' is uninitialized when used within its own initialization}} int aa = (ref(aa) += 10); // expected-warning {{variable 'aa' is uninitialized when used within its own initialization}} +int bb = bb ? x : y; // expected-warning {{variable 'bb' is uninitialized when used within its own initialization}} void test_stuff () { int a = a; // no-warning: used to signal intended lack of initialization. @@ -83,6 +84,8 @@ void test_stuff () { int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning {{variable 'y' is uninitialized when used within its own initialization}} int z = ++ref(z); // expected-warning {{variable 'z' is uninitialized when used within its own initialization}} int aa = (ref(aa) += 10); // expected-warning {{variable 'aa' is uninitialized when used within its own initialization}} + int bb = bb ? x : y; // expected-warning {{variable 'bb' is uninitialized when used within its own initialization}} + for (;;) { int a = a; // no-warning: used to signal intended lack of initialization. @@ -116,6 +119,8 @@ void test_stuff () { int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning {{variable 'y' is uninitialized when used within its own initialization}} int z = ++ref(z); // expected-warning {{variable 'z' is uninitialized when used within its own initialization}} int aa = (ref(aa) += 10); // expected-warning {{variable 'aa' is uninitialized when used within its own initialization}} + int bb = bb ? x : y; // expected-warning {{variable 'bb' is uninitialized when used within its own initialization}} + } } @@ -522,6 +527,8 @@ namespace statics { static int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning {{variable 'y' is uninitialized when used within its own initialization}} static int z = ++ref(z); // expected-warning {{variable 'z' is uninitialized when used within its own initialization}} static int aa = (ref(aa) += 10); // expected-warning {{variable 'aa' is uninitialized when used within its own initialization}} + static int bb = bb ? x : y; // expected-warning {{variable 'bb' is uninitialized when used within its own initialization}} + void test() { static int a = a; // no-warning: used to signal intended lack of initialization. @@ -555,7 +562,9 @@ namespace statics { static int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning {{static variable 'y' is suspiciously used within its own initialization}} static int z = ++ref(z); // expected-warning {{static variable 'z' is suspiciously used within its own initialization}} static int aa = (ref(aa) += 10); // expected-warning {{static variable 'aa' is suspiciously used within its own initialization}} - for (;;) { + static int bb = bb ? x : y; // expected-warning {{static variable 'bb' is suspiciously used within its own initialization}} + + for (;;) { static int a = a; // no-warning: used to signal intended lack of initialization. static int b = b + 1; // expected-warning {{static variable 'b' is suspiciously used within its own initialization}} static int c = (c + c); // expected-warning 2{{static variable 'c' is suspiciously used within its own initialization}} @@ -587,6 +596,7 @@ namespace statics { static int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning {{static variable 'y' is suspiciously used within its own initialization}} static int z = ++ref(z); // expected-warning {{static variable 'z' is suspiciously used within its own initialization}} static int aa = (ref(aa) += 10); // expected-warning {{static variable 'aa' is suspiciously used within its own initialization}} + static int bb = bb ? x : y; // expected-warning {{static variable 'bb' is suspiciously used within its own initialization}} } } } |

