https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91345
Bug ID: 91345 Summary: Typedef'ed restrict pointers may break compilation. Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: a-yee at u dot northwestern.edu Target Milestone: --- Potentially Related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91344 The following code compiles on Clang, MSVC, and ICC. But it fails on GCC. https://godbolt.org/z/6pTjDc #ifdef _WIN32 #define RESTRICT __restrict #else #define RESTRICT __restrict__ #endif template <typename type> using r_ptr = type *RESTRICT; template <typename Type> class Child{ void func(r_ptr<int> ptr); }; template <> void Child<int>::func(r_ptr<int> ptr){} GCC fails to compile it: <source>:8:18: error: template-id 'func<>' for 'void Child<int>::func(r_ptr<int>)' does not match any template declaration 8 | template <> void Child<int>::func(r_ptr<int> ptr){} | ^~~~~~~~~~ <source>:8:49: note: saw 1 'template<>', need 2 for specializing a member function template 8 | template <> void Child<int>::func(r_ptr<int> ptr){} | ^ ASM generation compiler returned: 1 <source>:8:18: error: template-id 'func<>' for 'void Child<int>::func(r_ptr<int>)' does not match any template declaration 8 | template <> void Child<int>::func(r_ptr<int> ptr){} | ^~~~~~~~~~ <source>:8:49: note: saw 1 'template<>', need 2 for specializing a member function template 8 | template <> void Child<int>::func(r_ptr<int> ptr){} | ^ Execution build compiler returned: 1