Open
Description
I've noticed two similar issue with conditional expressions. In both cases, clang does not believe the conditional is checked even though the branches are checked on their own.
void foo(void) {
int a, b;
_Ptr<int> c = 0 ? &a : &b;
}
z.c:3:17: error: expression has unknown bounds, cast to ptr<T> expects source to have bounds
_Ptr<int> c = 0 ? &a : &b;
void f(void) {}
void g(void) {}
void bar(void) {
_Ptr<void(void)> h = 0 ? f : g;
}
y.c:5:24: error: cannot guarantee operand of cast to checked function pointer type '_Ptr<void (void)>' is a function pointer
_Ptr<void(void)> h = 0 ? f : g;
^~~~~~~~~
1 error generated.