Commit 5675808f by Jason Merrill Committed by Jason Merrill

PR c++/81671 - nullptr_t template parameter

	* pt.c (convert_nontype_argument): Fix nullptr_t check.

From-SVN: r251046
parent 81f2064e
2017-08-11 Jason Merrill <jason@redhat.com>
PR c++/81671 - nullptr_t template parameter
* pt.c (convert_nontype_argument): Fix nullptr_t check.
2017-08-10 Jason Merrill <jason@redhat.com> 2017-08-10 Jason Merrill <jason@redhat.com>
PR c++/81359 - Unparsed NSDMI error from SFINAE context. PR c++/81359 - Unparsed NSDMI error from SFINAE context.
......
...@@ -6879,7 +6879,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) ...@@ -6879,7 +6879,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
} }
else if (NULLPTR_TYPE_P (type)) else if (NULLPTR_TYPE_P (type))
{ {
if (expr != nullptr_node) if (!NULLPTR_TYPE_P (TREE_TYPE (expr)))
{ {
if (complain & tf_error) if (complain & tf_error)
error ("%qE is not a valid template argument for type %qT " error ("%qE is not a valid template argument for type %qT "
......
// PR c++/81671
// { dg-do compile { target c++11 } }
namespace std { typedef decltype(nullptr) nullptr_t; }
template<class R, class CB> struct Bar
{};
template<class R> struct Bar<R, std::nullptr_t>
{
template<std::nullptr_t> struct Bind { constexpr static int const cb = 0; };
};
int foo()
{
return Bar<int, decltype(nullptr)>::Bind<nullptr>::cb;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment