https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97376
Bug ID: 97376 Summary: Function type to function pointer type adjustment for non-type template paramter does not work when using decltype(auto) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: anders.granlund.0 at gmail dot com Target Milestone: --- Consider the following program: #include <iostream> #include <type_traits> template<decltype(auto) X> void f1() { } template<void X()> void f2() { } void ff() { } int main() { f1<ff>(); f2<ff>(); } When compiling it with -std=c++17 -pedantic-errors it gives a compilation error complaining that the non-type parameter X of the template f1 has type void () and that this is not a valid type for a non-type template paramter. The expected behaviour is that the type of X in f1 should instead be ajusted to void (*)() . This is what happens in template f2 . Note that clang gives the expected behaviour (no compilation errors). Compiler explorer link comparing clang and gcc: https://godbolt.org/z/PGbrYE