const IncompleteArrayType *getAsIncompleteArrayType(QualType T) {
return dyn_cast_or_null<IncompleteArrayType>(getAsArrayType(T));
}
-
+ const DependentSizedArrayType *getAsDependentSizedArrayType(QualType T) {
+ return dyn_cast_or_null<DependentSizedArrayType>(getAsArrayType(T));
+ }
+
/// getBaseElementType - Returns the innermost element type of an array type.
/// For example, will return "int" for int[m][n]
QualType getBaseElementType(const ArrayType *VAT);
// type [i]
case Type::DependentSizedArray: {
- const ArrayType *ArrayArg = dyn_cast<ArrayType>(Arg);
+ const ArrayType *ArrayArg = Context.getAsArrayType(Arg);
if (!ArrayArg)
return Sema::TDK_NonDeducedMismatch;
// Check the element type of the arrays
const DependentSizedArrayType *DependentArrayParm
- = cast<DependentSizedArrayType>(Param);
+ = Context.getAsDependentSizedArrayType(Param);
if (Sema::TemplateDeductionResult Result
= DeduceTemplateArguments(Context, TemplateParams,
DependentArrayParm->getElementType(),
template<typename T, unsigned N> struct B { };
template<typename T, unsigned N> B<T, N> g0(T (&array)[N]);
+template<typename T, unsigned N> B<T, N> g0b(const T (&array)[N]);
void test_g0() {
int array0[5];
B<int, 5> b0 = g0(array0);
const int array1[] = { 1, 2, 3};
B<const int, 3> b1 = g0(array1);
+ B<int, 3> b2 = g0b(array1);
}
template<typename T> B<T, 0> g1(const A<T>&);