mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
26 lines
687 B
C
26 lines
687 B
C
enum NonExhaustiveEnum {
|
|
NonExhaustiveEnumA = 0,
|
|
NonExhaustiveEnumB = 1,
|
|
NonExhaustiveEnumC = 2,
|
|
} __attribute__((enum_extensibility(open)));
|
|
|
|
static enum NonExhaustiveEnum getExpectedValue(void) {
|
|
return NonExhaustiveEnumB;
|
|
}
|
|
static enum NonExhaustiveEnum getUnexpectedValue(void) {
|
|
return (enum NonExhaustiveEnum)3;
|
|
}
|
|
|
|
enum LyingExhaustiveEnum {
|
|
LyingExhaustiveEnumA = 0,
|
|
LyingExhaustiveEnumB = 1,
|
|
LyingExhaustiveEnumC = 2,
|
|
} __attribute__((enum_extensibility(closed)));
|
|
|
|
static enum LyingExhaustiveEnum getExpectedLiarValue(void) {
|
|
return LyingExhaustiveEnumB;
|
|
}
|
|
static enum LyingExhaustiveEnum getUnexpectedLiarValue(void) {
|
|
return (enum LyingExhaustiveEnum)3;
|
|
}
|