Implement the GNU semantics for forward declarations of enum types in
C and C++. Fixes PR3688.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66282 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/enum.cpp b/test/SemaCXX/enum.cpp
index 7626e4a..c7748c3 100644
--- a/test/SemaCXX/enum.cpp
+++ b/test/SemaCXX/enum.cpp
@@ -23,3 +23,18 @@
Foo myvar = A;
myvar = B;
}
+
+/// PR3688
+struct s1 {
+ enum e1 (*bar)(void); // expected-error{{ISO C++ forbids forward references to 'enum' types}}
+};
+
+enum e1 { YES, NO };
+
+static enum e1 badfunc(struct s1 *q) {
+ // FIXME: the message below should probably give context information
+ // in those types.
+ return q->bar(); // expected-error{{incompatible type returning 'enum e1', expected 'enum e1'}}
+}
+
+enum e2; // expected-error{{ISO C++ forbids forward references to 'enum' types}}