According to C++ standards:
An evaluation A carries a dependency to an evaluation B if - the value of A is used as an operand of B, unless:
— B is an invocation of any specialization of std::kill_dependency (29.3), or
— A is the left operand of a built-in logical AND (&&, see 5.14) or logical OR (||, see 5.15) operator, or
— A is the left operand of a conditional (?:, see 5.16) operator, or
— A is the left operand of the built-in comma (,) operator (5.18); (...)
I can understand why the dependency ordered before relationship would stop upon kill_dependency call, but why operators such as logical AND, OR, comma, etc. would also break the dependency chain?
Does it mean the code below has undefined behavior?
//thread1
int y = 2
atomicVal.store(true);
//thread2
auto x = atomicVal.load(std::memory_order_consume);
cout << x && y;