return integer_one_node;
cp_unevaluated u;
tree expr = build_stub_object (from);
+ deferring_access_check_sentinel acs (dk_no_deferred);
return perform_implicit_conversion (to, expr, tf_none);
}
--- /dev/null
+// PR c++/107049
+// { dg-do compile { target c++11 } }
+// Failed access check should be a substitution failure, not an error.
+
+template<bool B>
+struct bool_constant { static constexpr bool value = B; };
+
+template<typename From, typename To>
+struct is_convertible
+: public bool_constant<__is_convertible(From, To)>
+{ };
+
+#if __cpp_variable_templates
+template<typename From, typename To>
+constexpr bool is_convertible_v = __is_convertible(From, To);
+#endif
+
+class Private
+{
+ operator int() const
+ {
+ static_assert( not is_convertible<Private, int>::value, "" );
+#if __cpp_variable_templates
+ static_assert( not is_convertible_v<Private, int>, "" );
+#endif
+ return 0;
+ }
+};
+
+static_assert( not is_convertible<Private, int>::value, "" );
+#if __cpp_variable_templates
+static_assert( not is_convertible_v<Private, int>, "" );
+#endif
--- /dev/null
+// PR c++/107049
+// { dg-do compile { target c++11 } }
+// Failed access check should be a substitution failure, not an error.
+
+template<bool B>
+struct bool_constant { static constexpr bool value = B; };
+
+template<typename From, typename To>
+struct is_nt_convertible
+: public bool_constant<__is_nothrow_convertible(From, To)>
+{ };
+
+#if __cpp_variable_templates
+template<typename From, typename To>
+constexpr bool is_nt_convertible_v = __is_nothrow_convertible(From, To);
+#endif
+
+class Private
+{
+ operator int() const
+ {
+ static_assert( not is_nt_convertible<Private, int>::value, "" );
+#if __cpp_variable_templates
+ static_assert( not is_nt_convertible_v<Private, int>, "" );
+#endif
+ return 0;
+ }
+};
+
+static_assert( not is_nt_convertible<Private, int>::value, "" );
+#if __cpp_variable_templates
+static_assert( not is_nt_convertible_v<Private, int>, "" );
+#endif
--- /dev/null
+// { dg-do compile { target c++11 } }
+// PR c++/107049
+
+#include <type_traits>
+
+class Private
+{
+ operator int() const
+ {
+ static_assert( not std::is_convertible<Private, int>::value, "" );
+#if __cpp_lib_type_trait_variable_templates
+ static_assert( not std::is_convertible_v<Private, int>, "" );
+#endif
+ return 0;
+ }
+};
+
+static_assert( not std::is_convertible<Private, int>::value, "" );