From 59e01f364927e66c0bb1ebc22c401cf2630616c0 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 2 Aug 2019 18:17:20 +0000 Subject: [PATCH] re PR c++/56428 ([C++11] "is not a constant expression" when comparing non-type template argument to nullptr) PR c++/56428 * g++.dg/cpp0x/nontype4.C: New test. From-SVN: r274028 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/nontype4.C | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/nontype4.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d57410cb92b..147d8f8536f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-08-02 Marek Polacek + + PR c++/56428 + * g++.dg/cpp0x/nontype4.C: New test. + 2019-08-02 Marek Polacek PR c++/53009 diff --git a/gcc/testsuite/g++.dg/cpp0x/nontype4.C b/gcc/testsuite/g++.dg/cpp0x/nontype4.C new file mode 100644 index 00000000000..2c552d00293 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nontype4.C @@ -0,0 +1,25 @@ +// PR c++/56428 +// { dg-do compile { target c++11 } } + +struct A { }; + +template + struct Builder + { + static A build() { return A(); } + }; + +template + A f() + { + return Builder::build(); + } + +A g(); + +int main() +{ + f< &g >(); + f< nullptr >(); + f< &f >(); +} -- 2.30.2