public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110140] New: Vector extensions cause false conflict in template argument deduction
@ 2023-06-06 11:53 gcc-bugzilla at richardebeling dot de
  2023-06-06 17:18 ` [Bug c++/110140] " pinskia at gcc dot gnu.org
  2023-06-06 17:19 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: gcc-bugzilla at richardebeling dot de @ 2023-06-06 11:53 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/110140] Vector extensions cause false conflict in template argument deduction
  2023-06-06 11:53 [Bug c++/110140] New: Vector extensions cause false conflict in template argument deduction gcc-bugzilla at richardebeling dot de
@ 2023-06-06 17:18 ` pinskia at gcc dot gnu.org
  2023-06-06 17:19 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-06 17:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110140

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have seen this exact case before. PR 107123 is about deduction of the vector
size.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/110140] Vector extensions cause false conflict in template argument deduction
  2023-06-06 11:53 [Bug c++/110140] New: Vector extensions cause false conflict in template argument deduction gcc-bugzilla at richardebeling dot de
  2023-06-06 17:18 ` [Bug c++/110140] " pinskia at gcc dot gnu.org
@ 2023-06-06 17:19 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-06 17:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110140

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 100765.

*** This bug has been marked as a duplicate of bug 100765 ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-06 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 11:53 [Bug c++/110140] New: Vector extensions cause false conflict in template argument deduction gcc-bugzilla at richardebeling dot de
2023-06-06 17:18 ` [Bug c++/110140] " pinskia at gcc dot gnu.org
2023-06-06 17:19 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).