https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80737
Bug ID: 80737 Summary: variant<any> as class member resulting to compile errors Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: z-1st at mail dot ru Target Milestone: --- variant<any> works as expected outside the class. But if it is declared as a class member it doesn't compile in some cases The following example doesn't compile struct MyClass { variant<any> var; }; int main() { MyClass s; //fail return 0; } However, the following compiles MyClass s{}; //works MyClass s{1};//works Also, it is not possible to write custom constructors arount it. Example output: https://godbolt.org/g/NNQR09