Issue 61518
Summary Initializing a _Complex variable with an initializer list with too many items highlights the wrong item
Labels good first issue, clang:frontend, clang:diagnostics
Assignees
Reporter tbaederr
    See:

```c++
constexpr _Complex double d = {1.0, 2.0, 3.0, 45};
constexpr  double e[2]      = {1.0, 2.0, 3.0, 45};
```
Godbolt: https://godbolt.org/z/P7vqM4dq9

Output:

```console
<source>:3:37: error: excess elements in scalar initializer
constexpr _Complex double d = {1.0, 2.0, 3.0, 45};
 ^~~
<source>:4:42: error: excess elements in array initializer
constexpr  double e[2]      = {1.0, 2.0, 3.0, 45};
 ^~~
```

Clang highlights the second entry for the `_Complex` variable, but it should highlight the first I think.

I have other issues with the diagnostics here, but since this is about `_Complex` and that is a fringe feature anyway, I don't care much about those and fixing the off-by-one error should be enough.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to