ptr_refs exposed a problem in ClangASTContext's implementation; it uses an accessor to convert a QualType into an ObjCObjectPointerType, but the accessor is not fully general. getAs() is the safer way to go.
I've added a test case that uses ptr_refs in a way that would crash before the fix.