enum E { Val1,
Val2
};
enum E;
int& enumerator_type(int);
float& enumerator_type(E);
void f() {
E e = Val1;
float& fr = enumerator_type(Val2);
}
typedef enum Foo {
A = 0,
B = 1
} Foo;
void bar() {
Foo myvar = A;
myvar = B;
}
struct s1 {
enum e1 (*bar)(void); };
enum e1 { YES, NO };
static enum e1 badfunc(struct s1 *q) {
return q->bar();
}
enum e2;
namespace test1 {
template <class A, class B> struct is_same { static const int value = -1; };
template <class A> struct is_same<A,A> { static const int value = 1; };
enum enum0 { v0 };
int test0[is_same<__typeof(+v0), int>::value];
enum enum1 { v1 = __INT_MAX__ };
int test1[is_same<__typeof(+v1), int>::value];
enum enum2 { v2 = __INT_MAX__ * 2U };
int test2[is_same<__typeof(+v2), unsigned int>::value];
enum enum3 { v3 = __LONG_MAX__ };
int test3[is_same<__typeof(+v3), long>::value];
enum enum4 { v4 = __LONG_MAX__ * 2UL };
int test4[is_same<__typeof(+v4), unsigned long>::value];
}
namespace PR6061 {
struct A { enum { id }; };
struct B { enum { id }; };
struct C : public A, public B
{
enum { id };
};
}
namespace Conditional {
enum a { A }; a x(const enum a x) { return 1?x:A; }
}
namespace PR7051 {
enum E { e0 };
void f() {
E e;
e = 1; e |= 1; }
}
enum { }; typedef enum { };
enum PR7921E {
PR7921V = (PR7921E)(123) };
void PR8089() {
enum E; int a = (E)3; }