Declaration of never defined member function changes generated code
Martin Buchholz
martin@xemacs.org
Sat Dec 14 02:55:00 GMT 2002
>>>>> "G" == Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
G> Martin Buchholz <martin@xemacs.org> writes:
G> | This is related to my message "Failure to apply trivial peephole optimizations".
G> |
G> | Declaring (not defining) a member function should not cause generated
G> | code to be different.
G> Wrong. That depends on the kind of member function. If it is a copy
G> constructor (like in your case), then the compiler ought to use it
G> *whenever it copies* an object. That is just C++.
I should have been a little clearer.
Amended:
Declaring (but not defining) a member function should not cause
generated code to be different when that generated code is
successfully linked and invoked in an actual program.
(If the undefined copy constructor _were_ being used, we would see a
call to it in the generated asm, and we would get a link error.)
Martinc
More information about the Gcc
mailing list