1 // RUN: clang-cc -fsyntax-only -verify %s
2 enum E {
3   Val1,
4   Val2
5 };
6 
7 int& enumerator_type(int);
8 float& enumerator_type(E);
9 
10 void f() {
11   E e = Val1;
12   float& fr = enumerator_type(Val2);
13 }
14 
15 // <rdar://problem/6502934>
16 typedef enum Foo {
17 	A = 0,
18 	B = 1
19 } Foo;
20 
21 
22 void bar() {
23 	Foo myvar = A;
24 	myvar = B;
25 }
26 
27 /// PR3688
28 struct s1 {
29   enum e1 (*bar)(void); // expected-error{{ISO C++ forbids forward references to 'enum' types}} expected-note{{forward declaration of 'enum s1::e1'}}
30 };
31 
32 enum e1 { YES, NO };
33 
34 static enum e1 badfunc(struct s1 *q) {
35   return q->bar(); // expected-error{{return type of called function ('enum s1::e1') is incomplete}}
36 }
37 
38 enum e2; // expected-error{{ISO C++ forbids forward references to 'enum' types}}
39