Issue 120167
Summary [Clang] Matrix types are currently not supported in constant evaluation
Labels clang:frontend, constexpr
Assignees
Reporter Sirraide
    We support vector types, so supporting matrices as well would make sense, even though it sounds like it’d be quite a bit of work as it would probably involve adding a new `APValue` kind.

As an example, this (https://godbolt.org/z/WE84hhYvP):
```c++
template <typename T>
constexpr bool f() {
    T t = T();
    return true;
}

using M = int [[clang::matrix_type(4, 4)]];

static_assert(f<M>());
```
doesn’t work currently:
```console
<source>:9:15: error: static assertion _expression_ is not an integral constant _expression_
    9 | static_assert(f<M>());
      |               ^~~~~~
<source>:3:11: note: non-literal type 'int __attribute__((matrix_type(4, 4)))' cannot be used in a constant _expression_
    3 |     T t = T();
      |           ^
<source>:9:15: note: in call to 'f<int __attribute__((matrix_type(4, 4)))>()'
    9 | static_assert(f<M>());
      |               ^~~~~~
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to