[clang] [Clang] fix static operator()/[] call not evaluating object (PR #78356)

A. Jiang via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 18:46:55 PST 2024


================
@@ -598,3 +600,27 @@ namespace B {
 }
 void g(B::X x) { A::f(x); }
 }
+
+namespace static_operator {
+#if __cplusplus >= 201703L
----------------
frederick-vs-ja wrote:

> No way to modify things in a C++11/14 constexpr function (`++x` is not a constant expression), so no way to make a positive test that the expression was evaluated. Though I guess I should have done `(non_constexpr_fn(), X())()` and see if that failed.

Oh I see. It's inconvenient that runtime results can't be easily asserted in this test file.

I think the related changes of constexpr were made in C++14 ([N3652](https://wg21.link/n3652)).

https://github.com/llvm/llvm-project/pull/78356


More information about the cfe-commits mailing list