Add LLVM runtime checks to build path
[clang/acc.git] / test / SemaCXX / enum.cpp
blob9668c84693d3cdb5808b820fc9ed5aa687ffcab0
1 // RUN: clang-cc -fsyntax-only -verify %s
2 enum E {
3 Val1,
4 Val2
5 };
7 int& enumerator_type(int);
8 float& enumerator_type(E);
10 void f() {
11 E e = Val1;
12 float& fr = enumerator_type(Val2);
15 // <rdar://problem/6502934>
16 typedef enum Foo {
17 A = 0,
18 B = 1
19 } Foo;
22 void bar() {
23 Foo myvar = A;
24 myvar = B;
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'}}
32 enum e1 { YES, NO };
34 static enum e1 badfunc(struct s1 *q) {
35 return q->bar(); // expected-error{{return type of called function ('enum s1::e1') is incomplete}}
38 enum e2; // expected-error{{ISO C++ forbids forward references to 'enum' types}}