location_t save_loc = input_location;
input_location = loc;
++function_depth;
+ if (ctx->manifestly_const_eval)
+ FNDECL_MANIFESTLY_CONST_EVALUATED (fun) = true;
instantiate_decl (fun, /*defer_ok*/false, /*expl_inst*/false);
--function_depth;
input_location = save_loc;
FUNCTION_REF_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
OVL_LOOKUP_P (in OVERLOAD)
LOOKUP_FOUND_P (in RECORD_TYPE, UNION_TYPE, ENUMERAL_TYPE, NAMESPACE_DECL)
+ FNDECL_MANIFESTLY_CONST_EVALUATED (in FUNCTION_DECL)
5: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
#define FNDECL_USED_AUTO(NODE) \
TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE))
+/* True if NODE is needed for a manifestly constant-evaluated expression.
+ This doesn't especially need to be a flag, since currently it's only
+ used for error recovery; if we run out of function flags it could move
+ to an attribute. */
+#define FNDECL_MANIFESTLY_CONST_EVALUATED(NODE) \
+ TREE_LANG_FLAG_4 (FUNCTION_DECL_CHECK (NODE))
+
/* True for artificial decls added for OpenMP privatized non-static
data members. */
#define DECL_OMP_PRIVATIZED_MEMBER(NODE) \
{
return (d && DECL_P (d)
&& !undeduced_auto_decl (d)
- && !(TREE_CODE (d) == FUNCTION_DECL ? DECL_DECLARED_CONSTEXPR_P (d)
+ && !(TREE_CODE (d) == FUNCTION_DECL
+ ? FNDECL_MANIFESTLY_CONST_EVALUATED (d)
: decl_maybe_constant_var_p (d)));
}
--- /dev/null
+// PR c++/92193
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+ struct has_foo
+ { static constexpr bool value = false; };
+
+template<typename T>
+#ifndef NO_CONSTEXPR
+ constexpr
+#endif
+ bool
+ foo(T t) noexcept(noexcept(t.foo()))
+ { return t.foo(); }
+
+template<typename T>
+ void
+ maybe_foo(T t)
+ {
+ static_assert( has_foo<T>::value, "has foo" ); // { dg-error "has foo" }
+ foo(t);
+ }
+
+struct X { };
+
+int main()
+{
+ X x;
+ maybe_foo(x);
+}