Is there any way to make a type that has zero size and can only be constructed implicitly?
The use case is to prevent some public members of a struct from being initialized via the brace syntax:
class Barrier { ... };
struct Foo {
int user_sets;
int* this_to;
Barrier _bar;
int *must_be_zero_init_by_linker;
};
Foo foo = {1}; // ok
Foo bar = {1, nullptr}; // ok
Foo baz = {1, nullptr, {}}; // must error
Edit: one other constraint: The Foo object must be linker initialized so it can't define constructors or private members.