Commit 028c9b3b by Marek Polacek Committed by Marek Polacek

PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.

	* pt.c (invalid_nontype_parm_type_p): Only emit errors when
	tf_error.

	* g++.dg/cpp0x/nontype5.C: New test.

From-SVN: r276248
parent c57a3850
2019-09-28 Marek Polacek <polacek@redhat.com>
PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
* pt.c (invalid_nontype_parm_type_p): Only emit errors when
tf_error.
2019-09-27 Jakub Jelinek <jakub@redhat.com>
PR c++/88203
......
......@@ -25232,8 +25232,9 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
{
if (cxx_dialect < cxx2a)
{
error ("non-type template parameters of class type only available "
"with %<-std=c++2a%> or %<-std=gnu++2a%>");
if (complain & tf_error)
error ("non-type template parameters of class type only available "
"with %<-std=c++2a%> or %<-std=gnu++2a%>");
return true;
}
if (dependent_type_p (type))
......
2019-09-28 Marek Polacek <polacek@redhat.com>
PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
* g++.dg/cpp0x/nontype5.C: New test.
2019-09-28 Alan Modra <amodra@gmail.com>
PR testsuite/91676
......
// PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
// { dg-do compile { target c++11 } }
template<typename T>
constexpr bool is_integral_(...) {
return false;
}
template<typename T, T = 1>
constexpr bool is_integral_(long) {
return true;
}
static_assert(is_integral_<int>(42), "");
static_assert(!is_integral_<void>(42), "");
struct S {};
static_assert(!is_integral_<S>(42), "");
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