Hana =?utf-8?q?Dusíková?= <[email protected]>,
Hana =?utf-8?q?Dusíková?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -17893,4 +18005,425 @@ std::optional<bool>
EvaluateBuiltinIsWithinLifetime(IntExprEvaluator &IEE,
IsWithinLifetimeHandler handler{Info};
return findSubobject(Info, E, CO, Val.getLValueDesignator(), handler);
}
+
} // namespace
+
+static bool EvaluateAtomicOrder(const AtomicExpr *E, EvalInfo &Info) {
+ // We need to evaluate Order argument(s), but we ignore it as constant
+ // evaluation is single threaded.
----------------
AaronBallman wrote:
Is this actually correct though? My reading of https://eel.is/c++draft/atomics
keeps hitting preconditions that say "order is memory_order::relaxed,
memory_order::consume, memory_order::ac-
quire, or memory_order::seq_cst", which means we should reject code like
this, shouldn't we?
```
#include <atomic>
constexpr int foo(std::atomic<int> i) {
return i.load(static_cast<std::memory_order>(1001));
}
```
and while we don't have to catch UB in the library functions, it seems more
user-friendly to do so.
https://github.com/llvm/llvm-project/pull/98756
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits