Issue 133963
Summary Rejects-valid with static_assert referring to templated array variable with incomplete bound
Labels
Assignees
Reporter efriedma-quic
    ```
template<int x> int a[] = {1,2,3};
static_assert(a<1> + 1 - a<1> == 1);
```

```
<source>:2:15: error: static assertion _expression_ is not an integral constant _expression_
    2 | static_assert(a<1> + 1 - a<1> == 1);
 |               ^~~~~~~~~~~~~~~~~~~~
<source>:2:20: note: indexing of array without known bound is not allowed in a constant _expression_
    2 | static_assert(a<1> + 1 - a<1> == 1);
      |                    ^
1 error generated.
```

This seems wrong; I think referring to the array like this should force the computation of the correct type.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to