This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

signature S / ... S::f(...) const doesn't work !


When trying to keep `const' after S::value(), i cannot compile this example :

  #include "iostream"
 
  signature S
  {
    int value() const;
  };
 
  class C
  {
    int i;
  public:
    C(int i = 0) : i(i) {}
    int value() const
    {
      return i;
    }
    int dummy()
    {
    }
  };

  int main()
  {
    S *s = new C(10);
    cout
      << s->value() // <--- line 22 !
      << endl
    ;
    return 0;
  }

here is what I obtain :

essai.cc: In function `int main()':
essai.cc:22: Internal compiler error.
essai.cc:22: Please submit a full bug report.
essai.cc:22: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for instructions.

methinks using `const' after S::value() could not be a misuse, because if a pointer of "const class C" can only call "C::value() const" and a pointer of "class C" can both call "C::value() const" and "C::dummy()", so a pointer of "signature S" should also be both able to call "C::value() const" and "C::dummy()" !
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]