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
This commit is contained in:
Marek Polacek 2019-08-02 18:17:20 +00:00 committed by Marek Polacek
parent 8a2e0013a0
commit 59e01f3649
2 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2019-08-02 Marek Polacek <polacek@redhat.com>
PR c++/56428
* g++.dg/cpp0x/nontype4.C: New test.
2019-08-02 Marek Polacek <polacek@redhat.com>
PR c++/53009

View File

@ -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> >();
}