This is a fix for Bug 45383.
This revision fixes the error reported for array subscription for the cases where the array index is a template parameter.
Note that the ArraySubscriptExpr::getBase() might return something which might not be a base in the cases where either LHS or RHS of the ArraySubscriptExpr is a template declaration - I think the fundemental fix would include more changes with ArraySubscriptExpr::getBase() in the presence of template dependent types, but I thought it would involve a bigger scope of refactoring since many of the code is touching it.
Please also keep in mind this is my first patch, so I would be very glad for any kind of comment if I did something wrong.
Just QualType BaseType = ASE->getBase()->getType().getNonReferenceType(); and drop the call for getNonReferenceType() in later checks.