| 1 |
// RUN: %clang_cc1 -ffreestanding -emit-llvm -o - -std=c2x %s | FileCheck %s |
| 2 |
// RUN: %clang_cc1 -ffreestanding -std=c17 -verify %s |
| 3 |
|
| 4 |
/* WG14 N2826: Clang 17 |
| 5 |
* Add annotations for unreachable control flow v2 |
| 6 |
*/ |
| 7 |
#include <stddef.h> |
| 8 |
|
| 9 |
enum E { |
| 10 |
Zero, |
| 11 |
One, |
| 12 |
Two, |
| 13 |
}; |
| 14 |
|
| 15 |
int test(enum E e) { |
| 16 |
switch (e) { |
| 17 |
case Zero: return 0; |
| 18 |
case One: return 1; |
| 19 |
case Two: return 2; |
| 20 |
} |
| 21 |
unreachable(); // expected-error {{call to undeclared function 'unreachable'}} |
| 22 |
} |
| 23 |
|
| 24 |
// CHECK: switch i32 %0, label %[[EPILOG:.+]] [ |
| 25 |
// CHECK: [[EPILOG]]: |
| 26 |
// CHECK-NEXT: unreachable |