Sorry, I just wanted to demonstrate what I want to do. Hope this helps:
Code:
#include <cstddef>
#include <string>
struct base {
base(std::string label) {}
};
struct type {
type(std::size_t value) {}
};
int main()
{
struct object: base {
using base::base;
type member{0};
} object{"object"};
}
Code:
test.cc: In function ‘int main()’:
test.cc:20:20: error: use of deleted function ‘main()::third::third(std::string)’
} third{"third"};
^
test.cc:17:21: note: ‘main()::third::third(std::string)’ is implicitly deleted because the default definition would be ill-formed:
using base::base;
^
test.cc:17:21: error: no matching function for call to ‘type::type()’
test.cc:10:5: note: candidate: type::type(std::size_t)
type(std::size_t value);
^
test.cc:10:5: note: candidate expects 1 argument, 0 provided
test.cc:9:8: note: candidate: constexpr type::type(const type&)
struct type {
^
test.cc:9:8: note: candidate expects 1 argument, 0 provided
test.cc:9:8: note: candidate: constexpr type::type(type&&)
test.cc:9:8: note: candidate expects 1 argument, 0 provided
What I don't understand is how the switch from a custom constructor to a inherited one can change member initialization when both do the same thing?