https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110195

--- Comment #7 from jack <jack.cui2 at foxmail dot com> ---
(In reply to Jonathan Wakely from comment #6)
> The standard.

> In C++17 Single is an aggregate, and Single{} is aggregate-initialization,
> which initializes each member in turn, without calling a constructor. Since
> it doesn't use the constructor, it doesn't matter if it's private.
> ...
> ...
> In all these cases the type is not an aggregate, so Single{} always does
> value-initialization and always uses the constructor.
> 
> GCC is doing exactly what the standard requires.

Thanks for the detailed information. Clears my confusion.

Could we say this is a defect in C++ standard but fixed in C++20?

Reply via email to