Details
-
Bug
-
Status: New
-
Low
-
Resolution: Unresolved
-
Code Generation Tools
-
CODEGEN-3951
-
Description
In the following source code, the marked lines cause spurious errors about bypassing the initialization of an object.
However, the standard allows certain constructs, such as classes with trivial constructors, nonstatic member functions, and objects which contain or inherit from them to be bypassed since initialization is considered trivial.
struct trivial_struct { };
struct struct_with_member_fn { int b()
struct inherits_trivial_default_ctor : trivial_struct { };
struct inherits_nonstatic_member_fn : struct_with_member_fn { };
struct contains_trivial_default_member { inherits_trivial_default_ctor a; };
struct all_of_the_above : trivial_struct {
trivial_struct a;
int b() { return 2; }
};
extern int n;
int main()
{
// Error
// Error
// Error
// Error
}