diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-06 18:34:03 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-06 18:34:03 +0000 |
commit | d45b93bdd63465fe9802b9cb783caccbcf2cdcbf (patch) | |
tree | 534bc41dbb8afc6ba9be1a65df19b52555f6335b /clang/test/SemaCXX/enum.cpp | |
parent | 3a45e4fffb150623dcca47868eef2898fcca22cd (diff) | |
download | bcm5719-llvm-d45b93bdd63465fe9802b9cb783caccbcf2cdcbf.tar.gz bcm5719-llvm-d45b93bdd63465fe9802b9cb783caccbcf2cdcbf.zip |
Implement the GNU semantics for forward declarations of enum types in
C and C++. Fixes PR3688.
llvm-svn: 66282
Diffstat (limited to 'clang/test/SemaCXX/enum.cpp')
-rw-r--r-- | clang/test/SemaCXX/enum.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/enum.cpp b/clang/test/SemaCXX/enum.cpp index 7626e4ab695..c7748c31ba0 100644 --- a/clang/test/SemaCXX/enum.cpp +++ b/clang/test/SemaCXX/enum.cpp @@ -23,3 +23,18 @@ void bar() { 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}} |