[libcxx-commits] [libcxx] [libc++][chrono] Applied `[[nodiscard]]` to The Civil Calendar (PR #174968)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 10 10:01:50 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- libcxx/include/__chrono/day.h libcxx/include/__chrono/hh_mm_ss.h libcxx/include/__chrono/literals.h libcxx/include/__chrono/month.h libcxx/include/__chrono/month_weekday.h libcxx/include/__chrono/monthday.h libcxx/include/__chrono/weekday.h libcxx/include/__chrono/year.h libcxx/include/__chrono/year_month.h libcxx/include/__chrono/year_month_day.h libcxx/include/__chrono/year_month_weekday.h libcxx/test/libcxx/time/nodiscard.verify.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__chrono/year.h b/libcxx/include/__chrono/year.h
index 488072b4b..208d6eba0 100644
--- a/libcxx/include/__chrono/year.h
+++ b/libcxx/include/__chrono/year.h
@@ -115,7 +115,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept {
 
 template <>
 struct hash<chrono::year> {
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year& __y) noexcept { return static_cast<int>(__y); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year& __y) noexcept {
+    return static_cast<int>(__y);
+  }
 };
 
 #  endif // _LIBCPP_STD_VER >= 26

``````````

</details>


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


More information about the libcxx-commits mailing list