xmllmx
xmllmx

Reputation: 42255

Is there a constant expression that is not a core constant expression?

According to cppref, a constant expression is not bound to be a core constant expression.

My question:

Is there a constant expression that is not a core constant expression?

Upvotes: 0

Views: 203

Answers (2)

T.C.
T.C.

Reputation: 137320

[expr.const]/5 defines "constant expression" as:

A constant expression is either a glvalue core constant expression that refers to an entity that is a permitted result of a constant expression (as defined below), or a prvalue core constant expression whose value satisfies the following constraints: [...]

There is no such thing as a constant expression that isn't a core constant expression, and cppreference doesn't claim otherwise.

Upvotes: 4

1201ProgramAlarm
1201ProgramAlarm

Reputation: 32732

[expr.const] lists a whole series of things that are not core constant expressions. These include signed integer overflow (65536 * 32768 on a 32 bit machine), division by zero, and certain shift operations.

Upvotes: 1

Related Questions