My compiler (actually Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)) accepts (compile) that code :
class X {
private:
  int i;
public:
  const X() { cout << "here" << endl; i=0; }
  void f() const {}
  void g() {}
};
int main() {
  const X x;
  x.f();
  //  x.g();
  X y;
  y.f();
  y.g();
}
It works as if there is no const qualifier leading the ctor definition. I tried -Wall, -pedantic different kind of standard's activations, always the same... So :
- did I missed something ? I wasn't able to find that it is syntactically correct in the latest standard…
- is this a bug of gcc/llvm ? It seems that gcc/llvmsilently ignore theconst.
- is this a feature that I missed, and for which my example is not able to demonstrate its usefulness?
Note: gcc 3.4.3 don't compile it, nor gcc 4.4.5.
 
     
    