Sirraide wrote:

> 
> I was testing with `noreturn` earlier. It's hard to compare, because (at 
> least in C23):
> 
> ```
> ../clang/test/Sema/attr-nolock-wip.cpp:15:19: error: 'noreturn' attribute 
> cannot be applied to types
>    15 | void noret(int) [[noreturn]];
>       |                   ^
> ```

I think I was using `__attribute__((noreturn))` on a function pointer to test 
this. Adapted from `test/Sema/initialize-noreturn.c` 
(https://godbolt.org/z/q4qoaz8rP):
```c
typedef void (*Fn_noret)(void) __attribute__((noreturn));
void foo(void);
Fn_noret fn = foo;
```
This gives
```
<source>:3:10: error: incompatible function pointer types initializing 
'Fn_noret' (aka 'void (*)(void) __attribute__((noreturn))') with an expression 
of type 'void (void)' [-Wincompatible-function-pointer-types]
    3 | Fn_noret fn = foo;
      |          ^    ~~~
```

https://github.com/llvm/llvm-project/pull/84983
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to