http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55986
Bug #: 55986
Summary: RHS of logical operators may render LHS unevaluated in
constant-expression
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
This compiles without incident, despite using a non-constant object in a
constant-expression:
int i;
static_assert( i || true, "" );
static_assert( ! ( i && false ), "" );
It appears to be assuming that || and && are commutative, but short-circuiting
only works in one direction.