Fixed by r215409. The test is nice, so I'm adding it. Tested on x86_64-linux, applying to trunk.
2019-08-02 Marek Polacek <pola...@redhat.com> PR c++/56428 * g++.dg/cpp0x/nontype4.C: New test. diff --git gcc/testsuite/g++.dg/cpp0x/nontype4.C gcc/testsuite/g++.dg/cpp0x/nontype4.C new file mode 100644 index 00000000000..2c552d00293 --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/nontype4.C @@ -0,0 +1,25 @@ +// PR c++/56428 +// { dg-do compile { target c++11 } } + +struct A { }; + +template<bool B> + struct Builder + { + static A build() { return A(); } + }; + +template<A (*F)()> + A f() + { + return Builder<F != nullptr>::build(); + } + +A g(); + +int main() +{ + f< &g >(); + f< nullptr >(); + f< &f<nullptr> >(); +}