1 // RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++98 -verify -triple x86_64-apple-darwin %s
2 enum E { // expected-note{{previous definition is here}}
7 enum E; // expected-warning{{redeclaration of already-defined enum 'E' is a GNU extension}}
9 int& enumerator_type(int);
10 float& enumerator_type(E);
14 float& fr = enumerator_type(Val2);
17 // <rdar://problem/6502934>
30 enum e1 (*bar)(void); // expected-error{{ISO C++ forbids forward references to 'enum' types}}
35 static enum e1 badfunc(struct s1 *q) {
39 enum e2; // expected-error{{ISO C++ forbids forward references to 'enum' types}}
42 template <class A, class B> struct is_same { static const int value = -1; };
43 template <class A> struct is_same<A,A> { static const int value = 1; };
46 int test0[is_same<__typeof(+v0), int>::value];
48 enum enum1 { v1 = __INT_MAX__ };
49 int test1[is_same<__typeof(+v1), int>::value];
51 enum enum2 { v2 = __INT_MAX__ * 2U };
52 int test2[is_same<__typeof(+v2), unsigned int>::value];
54 enum enum3 { v3 = __LONG_MAX__ };
55 int test3[is_same<__typeof(+v3), long>::value];
57 enum enum4 { v4 = __LONG_MAX__ * 2UL };
58 int test4[is_same<__typeof(+v4), unsigned long>::value];
63 struct A { enum { id }; };
64 struct B { enum { id }; };
66 struct C : public A, public B
72 namespace Conditional {
73 enum a { A }; a x(const enum a x) { return 1?x:A; }
80 e = 1; // expected-error{{assigning to 'PR7051::E' from incompatible type 'int'}}
81 e |= 1; // expected-error{{assigning to 'PR7051::E' from incompatible type 'int'}}
86 enum { }; // expected-warning{{declaration does not declare anything}}
87 typedef enum { }; // expected-warning{{typedef requires a name}}