[Bug c++/126851] New: GCC accepts and ignores __restrict applied to a non-pointer type

attackerj1113 at gmail dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126851

            Bug ID: 126851
           Summary: GCC accepts and ignores __restrict applied to a
                    non-pointer type
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: attackerj1113 at gmail dot com
  Target Milestone: ---

GCC accepts and ignores __restrict applied to a non-pointer type:

==============================
template<class T>
struct A {
    using type = T __restrict;
};

A<int>::type value;
==============================

https://godbolt.org/z/3saYK59hh

GCC accepts __restrict applied to a non-pointer, non-reference type, whereas
Clang correctly rejects the code because restrict requires a pointer or
reference type.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.