diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/stack-addr-ps.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/convert-to-bool.cpp | 3 | ||||
-rw-r--r-- | test/SemaCXX/references.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/uninitialized.cpp | 19 |
4 files changed, 22 insertions, 4 deletions
diff --git a/test/Analysis/stack-addr-ps.cpp b/test/Analysis/stack-addr-ps.cpp index b21a03dc38..cbdb143c18 100644 --- a/test/Analysis/stack-addr-ps.cpp +++ b/test/Analysis/stack-addr-ps.cpp @@ -87,6 +87,6 @@ struct TS { // rdar://11345441 int* f5() { - int& i = i; // expected-warning {{Assigned value is garbage or undefined}} expected-note {{binding reference variable 'i' here}} + int& i = i; // expected-warning {{Assigned value is garbage or undefined}} expected-note {{binding reference variable 'i' here}} expected-warning{{variable 'i' is uninitialized when used within its own initialization}} return &i; // expected-warning {{address of stack memory associated with local variable 'i' returned}} } diff --git a/test/SemaCXX/convert-to-bool.cpp b/test/SemaCXX/convert-to-bool.cpp index c9a355549f..b52f11c93d 100644 --- a/test/SemaCXX/convert-to-bool.cpp +++ b/test/SemaCXX/convert-to-bool.cpp @@ -62,6 +62,5 @@ struct C { void test_copy_init_conversions(C c) { A &a = c; // expected-error{{no viable conversion from 'C' to 'A'}} - B &b = b; // okay + B &b = c; // okay } - diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp index 70d3799a0e..028c690921 100644 --- a/test/SemaCXX/references.cpp +++ b/test/SemaCXX/references.cpp @@ -136,4 +136,4 @@ namespace PR8608 { } // The following crashed trying to recursively evaluate the LValue. -const int &do_not_crash = do_not_crash; +const int &do_not_crash = do_not_crash; // expected-warning{{variable 'do_not_crash' is uninitialized when used within its own initialization}} diff --git a/test/SemaCXX/uninitialized.cpp b/test/SemaCXX/uninitialized.cpp index 890f212930..385548b51c 100644 --- a/test/SemaCXX/uninitialized.cpp +++ b/test/SemaCXX/uninitialized.cpp @@ -378,3 +378,22 @@ namespace statics { } } } + +namespace references { + int &a = a; // expected-warning{{variable 'a' is uninitialized when used within its own initialization}} + + struct S { + S() : a(a) {} // expected-warning{{field is uninitialized when used here}} + int &a; + }; + + void f() { + int &a = a; // expected-warning{{variable 'a' is uninitialized when used within its own initialization}} + } + + struct T { + T() : a(b), b(a) {} // FIXME: Warn here. + int &a, &b; + int &c = c; // FIXME: Warn here. + }; +} |