Suppose we want to declare const member function via typedef
:
typedef int FC() const;
typedef int F();
struct A
{
FC fc; // fine, we have 'int fc() const'
const F f; // not fine, 'const' is ignored, so we have 'int f()'
};
Since const
is ignored the program compiles fine. Why const
is ignored for function? Since we can form const pointer in this way the only thing I can think of is 'C heritage'. Does standard say anything about it?