This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: mutually-recursive types and an old puzzle


Joe Buck wrote:

Then this would not prevent STL iterators from being returned in
registers, as they don't have destructors and they don't have non-trivial
copy constructors (when not in debug mode).  But neither did my FsmState
example, and Zack says it can't be returned in a register.  So what gives?
In both cases, the iterator is generally a one-field object, where the one
field is a pointer; the copy constructor is the default one that just
copies the fields, and there is no destructor.
In the FSM example, I'm not sure why Zack says it can't be returned in
a register.  And given what you say about iterators, I don't see
why they can't be either (modulo underlying CABI restrictions).

That is incorrect.  Declaring a constructor does not force the user to
declare a copy constructor.

The correct statement is "if you declare *any* constructor, you have to
declare the *default* constructor (if you want one)."
yeah, I'd misremembered the rule.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



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