summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/warn-outof-range-assign-enum.c
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2013-06-06 13:48:00 +0000
committerJoey Gouly <joey.gouly@arm.com>2013-06-06 13:48:00 +0000
commit1ba2733e2cde7dbfa78f1a276a01b12760de2e28 (patch)
treeb22d268ba829908cf0d8046a377ccf0e5c9b3cdf /clang/test/Sema/warn-outof-range-assign-enum.c
parent5fe8a4f88fca4631ce04c28352c814292cdfb7f2 (diff)
downloadbcm5719-llvm-1ba2733e2cde7dbfa78f1a276a01b12760de2e28.tar.gz
bcm5719-llvm-1ba2733e2cde7dbfa78f1a276a01b12760de2e28.zip
Fix a crash with -Wassign-enum, where we didn't adjust the APInt type of the
constant. Also fix some spelling mistakes and formatting issues. Reviewed by Richard Smith over IRC. Fixes PR15069. llvm-svn: 183409
Diffstat (limited to 'clang/test/Sema/warn-outof-range-assign-enum.c')
-rw-r--r--clang/test/Sema/warn-outof-range-assign-enum.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Sema/warn-outof-range-assign-enum.c b/clang/test/Sema/warn-outof-range-assign-enum.c
index 2e79e66f49b..43eea0cef41 100644
--- a/clang/test/Sema/warn-outof-range-assign-enum.c
+++ b/clang/test/Sema/warn-outof-range-assign-enum.c
@@ -21,6 +21,18 @@ enum Test2 test2(enum Test2 *t) {
return 10; // expected-warning {{integer constant not in range of enumerated type 'enum Test2'}}
}
+// PR15069
+typedef enum
+{
+ a = 0
+} T;
+
+void f()
+{
+ T x = a;
+ x += 1; // expected-warning {{integer constant not in range of enumerated type}}
+}
+
int main() {
CCTestEnum test = 1; // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
test = 600; // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
OpenPOWER on IntegriCloud