diff options
author | Richard Trieu <rtrieu@google.com> | 2012-06-29 20:36:14 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2012-06-29 20:36:14 +0000 |
commit | 04ca19b97e85381920df7214f2c31b6833b314ce (patch) | |
tree | ac02a8ae140ee3e99ab93b6e30228040bc58d7a3 /test/SemaCXX/warn-unique-enum.cpp | |
parent | 6734ec41ab596088fd157b127f98aeae59ce8e6d (diff) |
Add a fix-it hint note to -Wunique-enum to suggest that the last element gets
initialized with the next to last element to silence the warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159458 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/warn-unique-enum.cpp')
-rw-r--r-- | test/SemaCXX/warn-unique-enum.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/SemaCXX/warn-unique-enum.cpp b/test/SemaCXX/warn-unique-enum.cpp index 7d04b1dc2d..c9e40b0014 100644 --- a/test/SemaCXX/warn-unique-enum.cpp +++ b/test/SemaCXX/warn-unique-enum.cpp @@ -1,8 +1,13 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify -Wunique-enum -enum A { A1 = 1, A2 = 1, A3 = 1 }; // expected-warning {{all elements of 'A' are initialized with literals to value 1}} +enum A { A1 = 1, A2 = 1, A3 = 1 }; // expected-warning {{all elements of 'A' are initialized with literals to value 1}} \ +// expected-note {{initialize the last element with the previous element to silence this warning}} enum { B1 = 1, B2 = 1, B3 = 1 }; // no warning -enum C { C1 = true, C2 = true}; // expected-warning {{all elements of 'C' are initialized with literals to value 1}} -enum D { D1 = 5, D2 = 5L, D3 = 5UL, D4 = 5LL, D5 = 5ULL }; // expected-warning {{all elements of 'D' are initialized with literals to value 5}} +enum C { // expected-warning {{all elements of 'C' are initialized with literals to value 1}} + C1 = true, + C2 = true // expected-note {{initialize the last element with the previous element to silence this warning}} +}; +enum D { D1 = 5, D2 = 5L, D3 = 5UL, D4 = 5LL, D5 = 5ULL }; // expected-warning {{all elements of 'D' are initialized with literals to value 5}} \ +// expected-note {{initialize the last element with the previous element to silence this warning}} // Don't warn on enums with less than 2 elements. enum E { E1 = 4 }; |