expr = build_converted_constant_bool_expr (expr, complain);
expr = instantiate_non_dependent_expr (expr, complain);
- expr = cxx_constant_value (expr);
+ expr = cxx_constant_value (expr, NULL_TREE, complain);
return expr;
}
{
expr = build_converted_constant_bool_expr (expr, complain);
expr = instantiate_non_dependent_expr (expr, complain);
- expr = cxx_constant_value (expr);
+ expr = cxx_constant_value (expr, NULL_TREE, complain);
}
if (TREE_CODE (expr) == INTEGER_CST)
{
else
{
hi = instantiate_non_dependent_expr (hi, complain);
- hi = cxx_constant_value (hi);
+ hi = cxx_constant_value (hi, NULL_TREE, complain);
int len = valid_constant_size_p (hi) ? tree_to_shwi (hi) : -1;
/* Calculate the largest value of len that won't make the size of the vec
/*function_p=*/false,
/*i_c_e_p=*/true);
spec = build_explicit_specifier (spec, complain);
+ if (spec == error_mark_node)
+ return error_mark_node;
if (instantiation_dependent_expression_p (spec))
store_explicit_specifier (r, spec);
else
--- /dev/null
+// Verify a non-constant conditional noexcept-specifier in a function type
+// respects SFINAE.
+// { dg-do compile { target c++17 } }
+
+template<class T> void f(void() noexcept(T::value)) = delete;
+template<class T> void f(...);
+
+struct B { static bool value; };
+
+int main() {
+ f<B>(nullptr);
+}
--- /dev/null
+// Verify a conditional explicit-specifier is a SFINAE context.
+// { dg-do compile { target c++20 } }
+
+struct A {
+ template<class T> explicit(T::value) A(T) = delete;
+ A(...);
+};
+
+struct B { static bool value; };
+
+A x(0);
+A y(B{});
--- /dev/null
+// Verify a non-constant argument to __integer_pack respects SFINAE.
+// { dg-do compile { target c++11 } }
+
+template<int...> struct A { };
+
+template<class T> auto f(int) -> A<__integer_pack(T::value)...> = delete;
+template<class T> void f(...);
+
+struct B { static int value; };
+
+int main() {
+ f<B>(0);
+}