T->isMemberPointerType() ||
// -- std::nullptr_t.
T->isNullPtrType() ||
- // If T is a dependent type, we can't do the check now, so we
- // assume that it is well-formed.
- T->isDependentType() ||
// Allow use of auto in template parameter declarations.
T->isUndeducedType()) {
// C++ [temp.param]p5: The top-level cv-qualifiers on the template-parameter
// A non-type template-parameter of type "array of T" or
// "function returning T" is adjusted to be of type "pointer to
// T" or "pointer to function returning T", respectively.
- else if (T->isArrayType() || T->isFunctionType())
+ if (T->isArrayType() || T->isFunctionType())
return Context.getDecayedType(T);
+ // If T is a dependent type, we can't do the check now, so we
+ // assume that it is well-formed. Note that stripping off the
+ // qualifiers here is not really correct if T turns out to be
+ // an array type, but we'll recompute the type everywhere it's
+ // used during instantiation, so that should be OK. (Using the
+ // qualified type is equally wrong.)
+ if (T->isDependentType())
+ return T.getUnqualifiedType();
+
Diag(Loc, diag::err_template_nontype_parm_bad_type)
<< T;
template<typename T, int (*)[sizeof(sizeof(int))]> int &g(...);
int &rg = g<struct incomplete, &arr>(0);
}
+
+namespace complete_array_from_incomplete {
+ template <typename T, const char* const A[static_cast<int>(T::kNum)]>
+ class Base {};
+ template <class T, const char* const A[]>
+ class Derived : public Base<T, A> {};
+
+ struct T {
+ static const int kNum = 3;
+ };
+ extern const char *const kStrs[3] = {};
+ Derived<T, kStrs> d;
+}