[libcxx-commits] [libcxx] [libc++] Mini-cleanup for `[[nodiscard]]` (PR #172275)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 16 01:34:53 PST 2025


================
@@ -61,5 +61,14 @@ int main(int, char**) {
           E::create_hard_links   == ME(256),
         "Expected enumeration values do not match");
 
+  // Verify that compound assignment operators are not incorrectly marked [[nodiscard]],
+  // to avoid regression in https://llvm.org/PR171085.
+  {
+    E e = E::none;
+    e &= E::skip_existing;
+    e |= E::recursive;
+    e ^= E::create_hard_links;
+  }
----------------
philnik777 wrote:

Could you add some simple tests to ensure they do what they're supposed to? Splitting these up into separate scopes and adding some asserts should be simple enough.

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


More information about the libcxx-commits mailing list