Commit daaa6fcc by Jason Merrill Committed by Jason Merrill

PR c++/90101 - dependent class non-type parameter.

We shouldn't complain that a dependent type is incomplete.

	* pt.c (invalid_nontype_parm_type_p): Check for dependent class type.

From-SVN: r273592
parent 59febe0e
2019-07-19 Jason Merrill <jason@redhat.com>
PR c++/90101 - dependent class non-type parameter.
* pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
2019-07-18 Jason Merrill <jason@redhat.com> 2019-07-18 Jason Merrill <jason@redhat.com>
PR c++/90098 - partial specialization and class non-type parms. PR c++/90098 - partial specialization and class non-type parms.
......
...@@ -25228,6 +25228,8 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) ...@@ -25228,6 +25228,8 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
"with %<-std=c++2a%> or %<-std=gnu++2a%>"); "with %<-std=c++2a%> or %<-std=gnu++2a%>");
return true; return true;
} }
if (dependent_type_p (type))
return false;
if (!complete_type_or_else (type, NULL_TREE)) if (!complete_type_or_else (type, NULL_TREE))
return true; return true;
if (!literal_type_p (type)) if (!literal_type_p (type))
......
// PR c++/90101
// { dg-do compile { target c++2a } }
template<int N>
struct A{};
template<int N, A<N>>
struct B {};
B<2,A<2>{}> b;
// PR c++/90100
// { dg-do compile { target c++2a } }
template<typename T>
inline constexpr bool is_nontype_list = false;
template<template<auto...> typename T, auto... NonTypes>
inline constexpr bool is_nontype_list<T<NonTypes...>> = true;
// works
template<auto...>
struct A {};
static_assert(is_nontype_list<A<1, 2, 3>>);
// fails
struct X {
int v;
};
static_assert(is_nontype_list<A<X{1}, X{2}, X{3}>>);
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