(AST) how to determine if a reference can be replaced with a reference to const?

Suppose that I have some non-const reference ref of type T&. Suppose that I have some expression, e.g.:

RunFunction(ref.CallSomeMethod())

where overloaded CallSomeMethod has signatures
int& T::CallSomeMethod() &;

const int& T::CallSomeMethod() const&;

What is the best way to determine though AST if the the program would still compile with the following modification?
RunFunction(static_cast<const T&>(ref).CallSomeMethod())

I’m writing a refactoring tool which rewrites public fields to fields with getters. The thing is, I have different member functions for const and mutable access, e.g.:
int& T::MutableField() &;
const int& T::Field() const&;

I would like to be able to distinguish between const/mutable access using AST.

Best,
Nikita