autocxx
autocxx copied to clipboard
Member initializers are ignored when checking for default constructors
Expected Behavior
If members of types without default constructors have default initializers, they should not prevent treating a class as though it has a default constructor, when the default constructor is defaulted (implicitly or explicitly).
Actual Behavior
Only the types of member variables are examined.
I'm working on implementing more complete logic for detecting types with default constructors, but this needs more information from bindgen (see #124) so I'm going to leave it for now.
Workaround with minimal change on the C++ side: define an explicit default constructor (either = default
or with an empty body). There might be some subtle changes in the behavior of that in C++, but I think they're all pretty esoteric.
If #815 is fixed before this, then = default
will prevent autocxx from using that default constructor.
Next step here is to add a failing test. Marking 'good first issue' for anyone who wants to do that.