https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110140
Bug ID: 110140
Summary: Vector extensions cause false conflict in template
argument deduction
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gcc-bugzilla at richardebeling dot de
Target Milestone: ---
This code snippet does not compile with GCC 13.1 and the current "trunk"
version on godbolt (see https://godbolt.org/z/7zcTq4nGz)
```c++
template <typename T>
using Vec __attribute__((vector_size(16))) = T;
template <typename T>
void foo(Vec<T> arg1, T arg2) {}
void bar() {
foo(Vec<int>{}, 1);
}
```
with this error:
```
<source>: In function 'void bar()':
<source>:8:8: error: no matching function for call to 'foo(Vec<int>, int)'
8 | foo(Vec<int>{}, 1);
| ~~~^~~~~~~~~~~~~~~
<source>:5:6: note: candidate: 'template<class T> void foo(Vec<T>, T)'
5 | void foo(Vec<T> arg1, T arg2) {}
| ^~~
<source>:5:6: note: template argument deduction/substitution failed:
<source>:8:8: note: deduced conflicting types for parameter 'T' ('__vector(4)
int' and 'int')
8 | foo(Vec<int>{}, 1);
| ~~~^~~~~~~~~~~~~~~
```
To me, it seems like `T` should be deduced to be `int` here and the conflicting
detected type `__vector(4) int` is a bug.
If the call to `foo` is changed to explicitly name the template argument as
`int` (-> `foo<int>(Vec<int>{}, 1);`), the code compiles.