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:
parent
8a2e0013a0
commit
59e01f3649
@ -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
|
||||
|
25
gcc/testsuite/g++.dg/cpp0x/nontype4.C
Normal file
25
gcc/testsuite/g++.dg/cpp0x/nontype4.C
Normal 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> >();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user