Fix template argument of nullptr_t type.
* pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than nullptr_node. From-SVN: r249080
This commit is contained in:
parent
3d2e25a240
commit
c5d6c6d94e
@ -1,5 +1,8 @@
|
||||
2017-06-09 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
|
||||
nullptr_node.
|
||||
|
||||
* parser.c (cp_parser_constant_expression): Check
|
||||
potential_rvalue_constant_expression after decay_conversion.
|
||||
* pt.c (convert_nontype_argument): Don't require linkage in C++17.
|
||||
|
@ -6480,7 +6480,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
|
||||
|
||||
/* 14.3.2/5: The null pointer{,-to-member} conversion is applied
|
||||
to a non-type argument of "nullptr". */
|
||||
if (expr == nullptr_node && TYPE_PTR_OR_PTRMEM_P (type))
|
||||
if (NULLPTR_TYPE_P (expr_type) && TYPE_PTR_OR_PTRMEM_P (type))
|
||||
expr = fold_simple (convert (type, expr));
|
||||
|
||||
/* In C++11, integral or enumeration non-type template arguments can be
|
||||
|
9
gcc/testsuite/g++.dg/cpp0x/nullptr38.C
Normal file
9
gcc/testsuite/g++.dg/cpp0x/nullptr38.C
Normal file
@ -0,0 +1,9 @@
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
using nullptr_t = decltype(nullptr);
|
||||
|
||||
constexpr nullptr_t n = nullptr;
|
||||
|
||||
template <void *> struct A { };
|
||||
|
||||
A<n> a;
|
Loading…
Reference in New Issue
Block a user