| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s |
| 2 |
// expected-no-diagnostics |
| 3 |
|
| 4 |
enum X : short { A, B }; |
| 5 |
extern decltype(+A) x; |
| 6 |
extern int x; |
| 7 |
|
| 8 |
enum Y : long { C, D }; |
| 9 |
extern decltype(+C) y; |
| 10 |
extern long y; |
| 11 |
|
| 12 |
// An enum with a fixed underlying type has an integral promotion to that type, |
| 13 |
// and to its promoted type. |
| 14 |
enum B : bool { false_, true_ }; |
| 15 |
template<bool> struct T {}; |
| 16 |
T<false_> f; |
| 17 |
T<true_> t; |
| 18 |
// FIXME: DR1407 will make this ill-formed |
| 19 |
T<+true_> q; // desired-error {{conversion from 'int' to 'bool'}} |
| 20 |
|
| 21 |
enum B2 : bool { |
| 22 |
a = false, |
| 23 |
b = true, |
| 24 |
c = false_, |
| 25 |
d = true_, |
| 26 |
// FIXME: DR1407 will make this ill-formed |
| 27 |
e = +false_ // desired-error {{conversion from 'int' to 'bool'}} |
| 28 |
}; |
| 29 |
|
| 30 |
namespace GH56560 { |
| 31 |
enum GH56560_1 : bool; |
| 32 |
bool GH56560_2(GH56560_1 a, GH56560_1 b) { |
| 33 |
return a == b; |
| 34 |
} |
| 35 |
} // namespace GH56560 |