From: Jason Merrill Date: Fri, 11 Aug 2017 05:35:39 +0000 (-0400) Subject: PR c++/81671 - nullptr_t template parameter X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5675808f5c0b9a91dfea8543828fa1c236b6467f;p=gcc.git PR c++/81671 - nullptr_t template parameter * pt.c (convert_nontype_argument): Fix nullptr_t check. From-SVN: r251046 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 792a42ad14a..0115f68cde6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-08-11 Jason Merrill + + PR c++/81671 - nullptr_t template parameter + * pt.c (convert_nontype_argument): Fix nullptr_t check. + 2017-08-10 Jason Merrill PR c++/81359 - Unparsed NSDMI error from SFINAE context. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0f899b9edec..bf1f75de1e7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6879,7 +6879,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) } else if (NULLPTR_TYPE_P (type)) { - if (expr != nullptr_node) + if (!NULLPTR_TYPE_P (TREE_TYPE (expr))) { if (complain & tf_error) error ("%qE is not a valid template argument for type %qT " diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr39.C b/gcc/testsuite/g++.dg/cpp0x/nullptr39.C new file mode 100644 index 00000000000..a34a6af73e9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr39.C @@ -0,0 +1,15 @@ +// PR c++/81671 +// { dg-do compile { target c++11 } } + +namespace std { typedef decltype(nullptr) nullptr_t; } + +template struct Bar +{}; +template struct Bar +{ + template struct Bind { constexpr static int const cb = 0; }; +}; +int foo() +{ + return Bar::Bind::cb; +}