http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50839
Bug #: 50839 Summary: Array parameters always take lower precedence than pointer parameters Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: classixret...@gmail.com Created attachment 25581 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25581 sample1 doesn't compile, whereas sample2 and sample3 do compile. The title says it all. sample1.cc does not compile, however, sample2.cc and sample3.cc do. Both were compiled with the -Wall and -std=gnu++0x flags. The expected output of sample2.cc should be: array[4] plus variadic pointer plus variadic variadic array[4] pointer generic However, ends up being: pointer plus variadic pointer plus variadic variadic pointer pointer generic Similarly, sample3.cc ends up being: variadic variadic generic generic Instead of: array[4] plus variadic variadic array[4] generic The GCC does not see any difference between void f(int[N]) and void f(int*). If you try to define two functions, it will say that void f(int*) is already defined, even if you are defining void f(int[N]) instead. You can get around this with some messy template work (as seem in the second sample), but it doesn't work as expected. Using templates, a specialization of int* will always take precedence over a specialization of int[N]. If I define a variadic function with an int[4] head and one without a head at all, it will assume the non-specialized version, which is incorrect (see sample3.cc). If you define a function with an int* head, it will work, but in that case, you cannot define the function as constexpr.