LLVM clang: error: default initialization of an object of const type 'class Exiv2::IptcData const' requires a user-provided default constructor
Recent clang issues the error message from subject. All the same messages are in the attachment. I am not sure it is an error.
Updated by Nikolai Saoukh almost 10 years ago
LLVM developer Chandler Carruth <firstname.lastname@example.org> replied:
ccd.cpp:12:10: error: default initialization of an object of const type 'B
const' requires a user-provided default constructor
Clang is correct: C++'03 [dcl.init] p9: If no initializer is specified for an
object, and the object is of (possibly cv-qualified) non-POD class type (or
array thereof), the object shall be default-initialized; if the object is of
const-qualified type, the underlying class type shall have a user-declared
The user declared default constructor for A makes A non-POD. The A member in B
makes B non-POD, and thus this rule kicks in, and the code provided is invalid.
You could re-open as a request for a GCC-compatibility setting to allow such
code, but I don't personally see a lot of value in it. Perhaps others do, so
feel free to re-open if you want to pursue that path.