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]

Re: function signature different in .o file!


> Date: Mon, 24 Jan 2000 18:31:50 -0600
> From: Amit Mehrotra <amehrotr@mail.icims.csl.uiuc.edu>

> I think this is a bug in g++. I have a function called
> setCurrentControlledSourceControllingBranchCurrent ( /* some definition
> */)
> I do a forward declaration of that, use it and later define it (all in
> the same .cc file). The file compiles without an error but at link time,
> ld says that the function is undefined. I did an nm on the .o file and
> grepped for this functions and I find the signatures of the two
> instances of this functions are different. Here are two signatures:

> If the signatures of the definition and the point of use were indeed
> different (they are not in my .cc code), the .cc file should not have
> compiled in the first place!

Not a bug.

The difference is a const.  You wind up with two completely different
functions.  You only defined one of them.

func (T const &, Y)
func (T &, Y)

Please add the missing const (or remove it from the other.  c++filt
will explain this problem to you.

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