https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101402
Bug ID: 101402 Summary: top cv qualifier not dropped for array type typedef in template class (core 1001) Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nickhuang99 at hotmail dot com Target Milestone: --- Created attachment 51127 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51127&action=edit a diagnositic message to print functions arguments for comparison This example code from core 1001(http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1001) is still giving no matching template declaration error. template<class T> struct A { typedef T arr[3]; }; template<class T> void f(const typename A<T>::arr) { } // #1 template void f<int>(const A<int>::arr); 1. This happens for all gcc versions. The root cause is template function argument is considered as ‘(const int*)’ instead of ‘(int*)’ (see attached debug output for details.) 2. C++ standard requires top level cv qualifier being dropped when forming function type.(https://timsong-cpp.github.io/cppwp/dcl.fct#5) 3. When both 'const' are removed from template function and specialization, there is no error which proves array type works as long as there is no top level cv qualifier. 4. I feel this is rather a high-profile bug as the example code is listed in active core language issues long ago, particularly when both clang and MSVC have fixed this issue. (see godbolt: https://www.godbolt.org/z/cofrEWEbs)