enum class Sema::ExpressionEvaluationContext

Description

Describes how the expressions currently being parsed are evaluated at run-time, if at all.

Declared at: clang/include/clang/Sema/Sema.h:1217

Enumerators

NameValueComment
Unevaluated0The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7), such as the subexpression of\c sizeof, where the type of the expression may be significant but no code will be generated to evaluate the value of the expression at run time.
UnevaluatedList1The current expression occurs within a braced-init-list within an unevaluated operand. This is mostly like a regular unevaluated context, except that we still instantiate constexpr functions that are referenced here so that we can perform narrowing checks correctly.
DiscardedStatement2The current expression occurs within a discarded statement. This behaves largely similarly to an unevaluated operand in preventing definitions from being required, but not in other ways.
UnevaluatedAbstract3The current expression occurs within an unevaluated operand that unconditionally permits abstract references to fields, such as a SIZE operator in MS-style inline assembly.
ConstantEvaluated4The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at compile-time (like the values of cases in a switch statement).
ImmediateFunctionContext5In addition of being constant evaluated, the current expression occurs in an immediate function context - either a consteval function or a consteval if function.
PotentiallyEvaluated6The current expression is potentially evaluated at run time, which means that code may be generated to evaluate the value of the expression at run time.
PotentiallyEvaluatedIfUsed7The current expression is potentially evaluated, but any declarations referenced inside that expression are only used if in fact the current expression is used.This value is used when parsing default function arguments, for which we would like to provide diagnostics (e.g., passing non-POD arguments through varargs) but do not want to mark declarations as "referenced" until the default argument is used.