Make sure to use ASTContext::getAs*ArrayType() when decomposing array
types. Fixes APFloat.cpp compilation failure. llvm-svn: 92523
This commit is contained in:
parent
699e014588
commit
936dc5638c
|
@ -996,7 +996,10 @@ public:
|
|||
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);
|
||||
|
|
|
@ -542,13 +542,13 @@ DeduceTemplateArguments(ASTContext &Context,
|
|||
|
||||
// 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(),
|
||||
|
|
|
@ -22,12 +22,14 @@ void test_f1(int i, const int ci, volatile int vi) {
|
|||
|
||||
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>&);
|
||||
|
|
Loading…
Reference in New Issue