[clang] fix crash with c-style casts involving dependent member-pointer types (#194696)
A dependent member-pointer type doesn't necessarily have a class
declaration.
This simplifies the check performed in a helper for diagnosing a cast
which removes qualifiers, so it doesn't rely on this assumption.
This fixes a regression introduced in
https://github.com/llvm/llvm-project/pull/132401, which landed in the
last release, and this will be back ported, so no release notes.
Fixes #194524
(cherry picked from commit c147ccadae917314a7d46510936e5c275e14fc18)