diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-07-21 19:28:10 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-07-21 19:28:10 +0000 |
commit | 6347f420ee0b097c0e642dc6c51afee5f1b14235 (patch) | |
tree | 34d4e1119f3dc8b67d132e9fe502d03bb8e39753 /test/SemaCXX/warn-reorder-ctor-initialization.cpp | |
parent | f0a6a0c29fb733b934930374554c84a83db5a790 (diff) |
Misc fixes for -Wreorder:
1. Make it work correctly with anonymous unions.
2. Don't compute it if the warning isn't enabled.
3. Optimize the algorithm slightly to make it linear time in the
case where we don't produce any warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76630 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 | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/SemaCXX/warn-reorder-ctor-initialization.cpp b/test/SemaCXX/warn-reorder-ctor-initialization.cpp index 107c89355e..a1990329ac 100644 --- a/test/SemaCXX/warn-reorder-ctor-initialization.cpp +++ b/test/SemaCXX/warn-reorder-ctor-initialization.cpp @@ -73,4 +73,17 @@ struct X : public virtual A, virtual V, public virtual B { // expected-note {{base 'struct V'}} }; - +class Anon { + int c; union {int a,b;}; int d; + Anon() : c(10), b(1), d(2) {} +}; +class Anon2 { + int c; union {int a,b;}; int d; + Anon2() : c(2), + d(10), // expected-warning {{member 'd' will be initialized after}} + b(1) {} // expected-note {{field b}} +}; +class Anon3 { + union {int a,b;}; + Anon3() : b(1) {} +}; |