Hana =?utf-8?q?Dusíková?= <hani...@hanicka.net>, Hana =?utf-8?q?Dusíková?= <hani...@hanicka.net> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/98...@github.com>
================ @@ -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 cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits