@@ -2319,6 +2319,30 @@ void test_lwg_3843() {
23192319static_assert (copyable<expected<any, int >>);
23202320static_assert (copyable<expected<void , any>>);
23212321
2322+ // Test workaround for DevCom-10655311: Class derived from std::expected can't be constructed with bool value type
2323+ template <class T , class E >
2324+ class DerivedFromExpected : private expected <T, E> {
2325+ public:
2326+ using expected<T, E>::expected;
2327+ using expected<T, E>::value;
2328+ };
2329+
2330+ static_assert (is_constructible_v<DerivedFromExpected<bool , int >, bool >);
2331+ static_assert (is_constructible_v<DerivedFromExpected<bool , int >, const bool &>);
2332+
2333+ constexpr bool test_inherited_constructors () {
2334+ DerivedFromExpected<bool , int > wrapped_false_val (false );
2335+ assert (!wrapped_false_val.value ());
2336+
2337+ constexpr bool true_val = true ;
2338+ DerivedFromExpected<bool , int > wrapped_true_val (true_val);
2339+ assert (wrapped_true_val.value ());
2340+
2341+ return true ;
2342+ }
2343+
2344+ static_assert (test_inherited_constructors());
2345+
23222346int main () {
23232347 test_unexpected::test_all ();
23242348 static_assert (test_unexpected::test_all ());
@@ -2335,4 +2359,5 @@ int main() {
23352359
23362360 test_reinit_regression ();
23372361 test_lwg_3843 ();
2362+ test_inherited_constructors ();
23382363}
0 commit comments