Closed robertramey closed 8 years ago
What is Dtor
?
If Dtor means a class with a non-trivial destructor, it makes it non-literal
[ constexpr
support was not a motivating force for Eggs.Variant, it just comes with the job ]
The two line snippet fails to compile because Dtor
is not declared. However, I am going to assume that it is referring to the utility class used in tests to track that destructors are actually caled. As @viboes explains, Dtor
is a class with a non-trivial destructor, so std::is_literal_type<Dtor>::value
yields false which makes the error expected:
Given the current language rules, a literal variant
requires all member types to be literal types. Once CWG2096 is applied, the rules will be relaxed to at least one member being a literal type, while the requirement for a trivial destructor would still mandate all members be trivially destructible.
So in short, Dtor
will never be a member of a literal variant
.
The following two line program provokes and error message in the latest version of Clang with Xcode.
This prevents me from using eggs/variant in a struct created by a constexpr function. My understanding was that one of the motivations of the eggs/variant variant is to facilitate the usage of variants in constexpr functions.
Robert Ramey