www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/25/17:16:02

From: Ewan Mellor <gateacre AT rmplc DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Signature bug?
Date: Mon, 24 Feb 1997 12:12:36 -0800
Organization: Gateacre CCS
Lines: 38
Message-ID: <3311F634.E96@rmplc.co.uk>
Reply-To: gateacre AT rmplc DOT co DOT uk
NNTP-Posting-Host: vpop-dyn-filt-59.rmplc.co.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Consider this source code:

signature Foosig {
   void Test() const;	// (1)
   };

class Foo {
public:
   void Test() const {	// (2)
      //  Testing Foo
      }
   };

main()
{
Foo f;
Foosig *fsp = &f;

fsp->Test();

return 0;
}

When I try to compile this (with the -fhandle-signatures flag,
obviously) I get the following error:

sig.cc:17: call to non-const method `void Foosig::Test() const' with
const object

This error message seems to contradict itself since it says I am calling
a non-const method, and then names the method as const.  If I remove the
const labelled (1) in the code it then compiles fine even though, to me,
method (2) no longer matches the signature method (1).  Is this a bug,
or am I doing something wrong?

Thanks for your time,

Ewan Mellor.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019