diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:04:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:04:05 +0000 |
commit | 676fbe8105eeb6ff4bb2ed261cb212fcfdbe7b63 (patch) | |
tree | 02a1ac369cb734d0abfa5000dd86e5b7797e6a74 /test/Sema/switch-availability.c | |
parent | c7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (diff) |
Diffstat (limited to 'test/Sema/switch-availability.c')
-rw-r--r-- | test/Sema/switch-availability.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Sema/switch-availability.c b/test/Sema/switch-availability.c new file mode 100644 index 0000000000000..888edddac463d --- /dev/null +++ b/test/Sema/switch-availability.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -verify -Wswitch -triple x86_64-apple-macosx10.12 %s + +enum SwitchOne { + Unavail __attribute__((availability(macos, unavailable))), +}; + +void testSwitchOne(enum SwitchOne so) { + switch (so) {} // no warning +} + +enum SwitchTwo { + Ed __attribute__((availability(macos, deprecated=10.12))), + Vim __attribute__((availability(macos, deprecated=10.13))), + Emacs, +}; + +void testSwitchTwo(enum SwitchTwo st) { + switch (st) {} // expected-warning{{enumeration values 'Vim' and 'Emacs' not handled in switch}} +} + +enum SwitchThree { + New __attribute__((availability(macos, introduced=1000))), +}; + +void testSwitchThree(enum SwitchThree st) { + switch (st) {} // expected-warning{{enumeration value 'New' not handled in switch}} +} |