summaryrefslogtreecommitdiff
path: root/test/Sema
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2013-08-08 01:50:23 +0000
committerRichard Trieu <rtrieu@google.com>2013-08-08 01:50:23 +0000
commitfbbdc5daee4dc772d4d137080890fd79492592d6 (patch)
tree7cdae24e740136717457e9672257c3eb8549d12b /test/Sema
parent9793fe99de5ab92162cb70a7d2584c1de0952d73 (diff)
downloadclang-fbbdc5daee4dc772d4d137080890fd79492592d6.tar.gz
Emit an error for enum increments and decrements in C++ mode.
Fixes PR16394. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187955 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema')
-rw-r--r--test/Sema/enum-increment.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Sema/enum-increment.c b/test/Sema/enum-increment.c
new file mode 100644
index 0000000000..baaa3489b9
--- /dev/null
+++ b/test/Sema/enum-increment.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+// expected-no-diagnostics
+enum A { A1, A2, A3 };
+typedef enum A A;
+void test() {
+ A a;
+ a++;
+ a--;
+ ++a;
+ --a;
+ a = a + 1;
+ a = a - 1;
+}