Issue 71698
Summary Unhelpful diagnostics when a multi-versioned `target_version("default")` definition comes first
Labels clang:diagnostics
Assignees
Reporter jroelofs
    The error message you get when specifying a `target_version("default")` as the first definition is really unhelpful. We should either:
  *  explicitly forbid that and improve the diagnostics such that they explain exactly what went wrong
  *   or (preferably) fix Sema and allow these to come in any order.

AFAICT, the ACLE doesn't place restrictions on the order that these may occur in: https://github.com/ARM-software/acle/blob/main/main/acle.md#function-multi-versioning

```
__attribute__((target_version("default")))
int callee() {
  return 0;
}

__attribute__((target_version("simd")))
int callee() {
  return 1;
}
```

```
example.c:6:16: warning: attribute declaration must precede definition [-Wignored-attributes]
    6 | __attribute__((target_version("simd")))
      | ^
example.c:2:5: note: previous definition is here
    2 | int callee() {
      |     ^
example.c:7:5: error: redefinition of 'callee'
    7 | int callee() {
      |     ^
example.c:2:5: note: previous definition is here
    2 | int callee() {
      |     ^
1 warning and 1 error generated.
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to