TYPE_NEEDS_CONSTRUCTING zero for std::string?
Florian Weimer
fweimer@redhat.com
Fri Oct 1 17:44:48 GMT 2021
* Martin Sebor via Gcc:
> I'd expect TYPE_NEEDS_CONSTRUCTING to be non-zero in the middle end
> for any C++ type with a user-defined ctor, but in some of my testing
> I see it's actually zero for std::string, at least in some instances
> (but nonzero for other types with ctors). Is there something special
> about std::string that makes it so? (If this is intentional, how can
> I create my own type that has a user-defined ctor and also a zero
> TYPE_NEEDS_CONSTRUCTING?)
I assume by writing an explicit default constructor:
T() = default;
Thanks,
Florian
More information about the Gcc
mailing list