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.