Issue 176070
Summary [Clang] On GCC, C23 `typeof` strips `noreturn` attribute on function pointers
Labels clang
Assignees
Reporter fuhsnn
    https://godbolt.org/z/e8M18778s
```C
[[gnu::noreturn]]
extern void(*fptr)(void);

int typeof_ext(int i, __typeof(fptr) p) {
    p();
 return i; // not emitted because p is noreturn
}

int typeof_std(int i, typeof(fptr) p) {
    p();
    return i; // emitted on GCC C23
}
```

When under C23 and using the standard (not underscored) spelling of `typeof`, GCC would remove the `noreturn` attribute from the function pointer type.
>From GCC's commit message (https://github.com/gcc-mirror/gcc/commit/fa258f6894801aef6785f0327594dc803da63fbd) this seems to be intentional.
Could be dangerous if someone rely on this behavior and only test with GCC.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to