1 // RUN: %clang_cc1 %s -fsyntax-only -verify -Wunique-enum 2 enum A { A1 = 1, A2 = 1, A3 = 1 }; // expected-warning {{all elements of 'A' are initialized with literals to value 1}} \ 3 // expected-note {{initialize the last element with the previous element to silence this warning}} 4 enum { B1 = 1, B2 = 1, B3 = 1 }; // no warning 5 enum C { // expected-warning {{all elements of 'C' are initialized with literals to value 1}} 6 C1 = true, 7 C2 = true // expected-note {{initialize the last element with the previous element to silence this warning}} 8 }; 9 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}} \ 10 // expected-note {{initialize the last element with the previous element to silence this warning}} 11 12 // Don't warn on enums with less than 2 elements. 13 enum E { E1 = 4 }; 14 enum F { F1 }; 15 enum G {}; 16 17 // Don't warn when integer literals do not initialize the elements. 18 enum H { H1 = 4, H_MAX = H1, H_MIN = H1 }; 19 enum I { I1 = H1, I2 = 4 }; 20 enum J { J1 = 4, J2 = I2 }; 21 enum K { K1, K2, K3, K4 }; 22 23 // Don't crash or warn on this one. 24 // rdar://11875995 25 enum L { 26 L1 = 0x8000000000000000ULL, L2 = 0x0000000000000001ULL 27 }; 28