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 | a61b3e7443056f8d05b24ca4cbea90fe66235d6b (patch) | |
tree | 5ed483b461473fc0d663356e107a19343e5b9f3b /test/SemaCXX/enum-bitfield.cpp | |
parent | d11617f6e0622bbf843d6f8d60c441f844e46e9a (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120582 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/enum-bitfield.cpp')
-rw-r--r-- | test/SemaCXX/enum-bitfield.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaCXX/enum-bitfield.cpp b/test/SemaCXX/enum-bitfield.cpp new file mode 100644 index 0000000000..a766116b1c --- /dev/null +++ b/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}} +}; |