public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100765] New: attribute incorrectly applied during type alias deduction
@ 2021-05-26 10:17 rustamabd at gmail dot com
  2021-08-12 14:49 ` [Bug c++/100765] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rustamabd at gmail dot com @ 2021-05-26 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100765
           Summary: attribute incorrectly applied during type alias
                    deduction
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rustamabd at gmail dot com
  Target Milestone: ---

template <typename T>
using vec __attribute__((vector_size(8))) = T;

template <typename T>
void test(vec<T> x) {}

int main() {
  test(vec<int>{1,2});
}

Compiles fine in Clang, but fails in GCC with:

In substitution of 'template<class T> using vec = T [with T = __vector(2)
int]':
   required by substitution of 'template<class T> void test(vec<T>) [with T =
__vector(2) int]'
   required from here
 error: invalid vector type for attribute 'vector_size'
    2 | using vec __attribute__((vector_size(8))) = T;
      |       ^~~

GCC seems to be applying __attribute__(vector_size) to int when deducing from
vec<int>.

Bypassing deduction makes the code compile:

  test<int>(vec<int>{1,2});

This issue seems to exist in all GCC versions starting from 4.7.0 until at
least the current (12.0) trunk.

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

* [Bug c++/100765] attribute incorrectly applied during type alias deduction
  2021-05-26 10:17 [Bug c++/100765] New: attribute incorrectly applied during type alias deduction rustamabd at gmail dot com
@ 2021-08-12 14:49 ` pinskia at gcc dot gnu.org
  2021-08-12 14:49 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 100766 has been marked as a duplicate of this bug. ***

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

* [Bug c++/100765] attribute incorrectly applied during type alias deduction
  2021-05-26 10:17 [Bug c++/100765] New: attribute incorrectly applied during type alias deduction rustamabd at gmail dot com
  2021-08-12 14:49 ` [Bug c++/100765] " pinskia at gcc dot gnu.org
@ 2021-08-12 14:49 ` pinskia at gcc dot gnu.org
  2021-08-12 14:52 ` pinskia at gcc dot gnu.org
  2023-06-06 17:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-12
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/100765] attribute incorrectly applied during type alias deduction
  2021-05-26 10:17 [Bug c++/100765] New: attribute incorrectly applied during type alias deduction rustamabd at gmail dot com
  2021-08-12 14:49 ` [Bug c++/100765] " pinskia at gcc dot gnu.org
  2021-08-12 14:49 ` pinskia at gcc dot gnu.org
@ 2021-08-12 14:52 ` pinskia at gcc dot gnu.org
  2023-06-06 17:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GNU++98 version:
#define vec __attribute__((vector_size(4)))
template <typename T>
vec T f(vec T);

vec int ff(vec int t)
{
    return f(t);
}

----- CUT ----
And one which rejects a different way:
#define vec __attribute__((vector_size(4)))
template <typename T>
vec T f(T a, vec T);

vec int ff(int a, vec int t)
{
    return f(a, t);
}

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

* [Bug c++/100765] attribute incorrectly applied during type alias deduction
  2021-05-26 10:17 [Bug c++/100765] New: attribute incorrectly applied during type alias deduction rustamabd at gmail dot com
                   ` (2 preceding siblings ...)
  2021-08-12 14:52 ` pinskia at gcc dot gnu.org
@ 2023-06-06 17:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ 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=100765

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc-bugzilla@richardebeling
                   |                            |.de

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 110140 has been marked as a duplicate of this bug. ***

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 10:17 [Bug c++/100765] New: attribute incorrectly applied during type alias deduction rustamabd at gmail dot com
2021-08-12 14:49 ` [Bug c++/100765] " pinskia at gcc dot gnu.org
2021-08-12 14:49 ` pinskia at gcc dot gnu.org
2021-08-12 14:52 ` 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).