diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-01 17:42:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-01 17:42:47 +0000 |
commit | d1f69f6a1d1dc321cca8f7e903454ded41f3b26a (patch) | |
tree | a61fc77969149a9f69e6c19083c06a379150fba6 /clang/test/SemaCXX/enum-bitfield.cpp | |
parent | be00735bcf4468a4bf768e7c15859b61fb32e134 (diff) | |
download | bcm5719-llvm-d1f69f6a1d1dc321cca8f7e903454ded41f3b26a.tar.gz bcm5719-llvm-d1f69f6a1d1dc321cca8f7e903454ded41f3b26a.zip |
After parsing a ':' in an enum-specifier within class context,
disambiguate between an expression (for a bit-field width) and a type
(for a fixed underlying type). Since the disambiguation can be
expensive (due to tentative parsing), we perform a simplistic
disambiguation based on one-token lookahead before going into the
full-blown tentative parsing. Based on a patch by Daniel Wallin.
llvm-svn: 120582
Diffstat (limited to 'clang/test/SemaCXX/enum-bitfield.cpp')
-rw-r--r-- | clang/test/SemaCXX/enum-bitfield.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/enum-bitfield.cpp b/clang/test/SemaCXX/enum-bitfield.cpp new file mode 100644 index 00000000000..a766116b1c3 --- /dev/null +++ b/clang/test/SemaCXX/enum-bitfield.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++0x -verify -triple x86_64-apple-darwin %s + +enum E {}; + +struct Z {}; +typedef int Integer; + +struct X { + enum E : 1; + enum E : Z; // expected-error{{invalid underlying type}} + enum E2 : int; + enum E3 : Integer; +}; + +struct Y { + enum E : int(2); + enum E : Z(); // expected-error{{not an integer constant}} +}; |