diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-09 19:59:47 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-09 19:59:47 +0000 |
commit | eb96e1275206b888eee484aac8b1b693417c6521 (patch) | |
tree | 862203bc0f1c4657305fde281dafd3e2ced35a3a /test/SemaCXX/warn-reorder-ctor-initialization.cpp | |
parent | 5e09d4c96dc2846cc1fc75f80f5632612247354b (diff) |
Sema check on out of order object initialization of
class object's base and members under -Wreorder flag.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/warn-reorder-ctor-initialization.cpp')
-rw-r--r-- | test/SemaCXX/warn-reorder-ctor-initialization.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-reorder-ctor-initialization.cpp b/test/SemaCXX/warn-reorder-ctor-initialization.cpp new file mode 100644 index 0000000000..83b671010c --- /dev/null +++ b/test/SemaCXX/warn-reorder-ctor-initialization.cpp @@ -0,0 +1,18 @@ +// RUN: clang-cc -fsyntax-only -Wreorder -verify %s + +struct B {}; + +struct B1 {}; + +class complex : public B, B1 { +public: + complex() : s2(1), // expected-warning {{member 's2' will be initialized after}} + s1(1) , // expected-note {{field s1}} + s3(3), // expected-warning {{member 's3' will be initialized after}} + B1(), // expected-note {{base 'struct B1'}} \ + // expected-warning {{base class 'struct B1' will be initialized after}} + B() {} // expected-note {{base 'struct B'}} + int s1; + int s2; + int s3; +}; |