return is_auto (t) && PLACEHOLDER_TYPE_CONSTRAINTS_INFO (t);
}
+/* True if CODE, a tree code, denotes a tree whose operand is not evaluated
+ as per [expr.context], i.e., an operand to sizeof, typeof, decltype, or
+ alignof. */
+
+inline bool
+unevaluated_p (tree_code code)
+{
+ return (code == DECLTYPE_TYPE
+ || code == ALIGNOF_EXPR
+ || code == SIZEOF_EXPR
+ || code == NOEXCEPT_EXPR);
+}
+
/* RAII class to push/pop the access scope for T. */
struct push_access_scope_guard
expression whose type is a polymorphic class type (10.3). */
static tree
-check_noexcept_r (tree *tp, int * /*walk_subtrees*/, void * /*data*/)
+check_noexcept_r (tree *tp, int *walk_subtrees, void *)
{
tree t = *tp;
enum tree_code code = TREE_CODE (t);
- if ((code == CALL_EXPR && CALL_EXPR_FN (t))
- || code == AGGR_INIT_EXPR)
+
+ if (unevaluated_p (code))
+ *walk_subtrees = false;
+ else if ((code == CALL_EXPR && CALL_EXPR_FN (t))
+ || code == AGGR_INIT_EXPR)
{
/* We can only use the exception specification of the called function
for determining the value of a noexcept expression; we can't use