diff options
author | Richard Trieu <rtrieu@google.com> | 2014-09-12 22:47:58 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2014-09-12 22:47:58 +0000 |
commit | 8a0c9e624764b705791b26ed98f66034b9896cef (patch) | |
tree | b8f4f8a7e843b154a4de1c57953e4382553a46a0 /clang/test/SemaCXX/uninitialized.cpp | |
parent | b8536b1db8302a367f727515b85a4eb60835ec84 (diff) | |
download | bcm5719-llvm-8a0c9e624764b705791b26ed98f66034b9896cef.tar.gz bcm5719-llvm-8a0c9e624764b705791b26ed98f66034b9896cef.zip |
Check delegating constructors for using uninitialized fields.
llvm-svn: 217716
Diffstat (limited to 'clang/test/SemaCXX/uninitialized.cpp')
-rw-r--r-- | clang/test/SemaCXX/uninitialized.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/uninitialized.cpp b/clang/test/SemaCXX/uninitialized.cpp index 8d0338c3d83..bb2ecabfc8a 100644 --- a/clang/test/SemaCXX/uninitialized.cpp +++ b/clang/test/SemaCXX/uninitialized.cpp @@ -861,3 +861,19 @@ namespace base_class { C() : A(y = 4), x(y) {} }; } + +namespace delegating_constructor { + struct A { + A(int); + A(int&, int); + + A(char (*)[1]) : A(x) {} + // expected-warning@-1 {{field 'x' is uninitialized when used here}} + A(char (*)[2]) : A(x, x) {} + // expected-warning@-1 {{field 'x' is uninitialized when used here}} + + A(char (*)[3]) : A(x, 0) {} + + int x; + }; +} |