Consider this
#include <iostream>
class A
{
public:
  void fun(int x) const
  {
    std::cout<<"int x"<<std::endl;
  }
  void fun(const int x)
  {
    std::cout<<"const int x"<<std::endl;
  }
  void fun(int &x)
  {
    std::cout<<"int &x"<<std::endl;
  }
  void fun(const int &x)
  {
    std::cout<<"const int &x"<<std::endl;
  }
};
int main()
{
  A obj;
  int a = 10;
  const int b = 10;
  int& ref = a;
  const int& ref1 = b;
  obj.fun(a);
  obj.fun(b);
  obj.fun(ref);
  obj.fun(ref1);
  return 0;
}
- Compiling this get ambiguities but none of them says its due to fun(const int x) but removing this makes code getting compiled correctly 
- What difference does it make when we make a argument const ex- fun(const int& x) and a function itself const ex - fun(int x) const while overload resolution 
There are some more doubts trying various combinations, so any generic answer explaining the role of const while overload resolution is welcome
 
    