https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110820
Bug ID: 110820
Summary: vector_size attribute does not apply inside a template
nttp argument
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
#define vector__ __attribute__((vector_size(sizeof(double)*4)))
typedef vector__ double v4d;
template<class, vector__ double> struct A { };
template<class T> void f(A<T, (vector__ double){1.0, 1.0, 2.0, 2.0}>);
```
The error message we get is:
<source>:6:66: error: could not convert '__vector(4) double{1.0e+0, 1.0e+0,
2.0e+0, 2.0e+0}' from '__vector(4) double' to 'double'
6 | template<class T> void f(A<T, (vector double){1.0, 1.0, 2.0, 2.0}>);
| ^
| |
|
__vector(4) double
```
Which does not make sense really since I put vector__ there.
Note using v4d instead of `vector__ double` in line #3 we get:
```
<source>:4:17: error: '__vector(4) double' is not a valid type for a template
non-type parameter because it is not structural
4 | template<class, v4d> struct A { };
| ^~~
```