[libcxx-commits] [libcxx] [libc++] Define behaviour for calling target() and target_type() on -fno-rtti std::functions (PR #209471)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 14 06:12:15 PDT 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/test/extensions/libcxx/utilities/function.objects/func.wrap/func.wrap.func/rtti_mixing.sh.cpp libcxx/include/__functional/function.h --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/test/extensions/libcxx/utilities/function.objects/func.wrap/func.wrap.func/rtti_mixing.sh.cpp b/libcxx/test/extensions/libcxx/utilities/function.objects/func.wrap/func.wrap.func/rtti_mixing.sh.cpp
index 9a6eda694..aeacc5dea 100644
--- a/libcxx/test/extensions/libcxx/utilities/function.objects/func.wrap/func.wrap.func/rtti_mixing.sh.cpp
+++ b/libcxx/test/extensions/libcxx/utilities/function.objects/func.wrap/func.wrap.func/rtti_mixing.sh.cpp
@@ -20,9 +20,7 @@
 std::function<void()> get_func();
 
 #ifdef NO_RTTI
-std::function<void()> get_func() {
-  return get_func;
-}
+std::function<void()> get_func() { return get_func; }
 #else
 int main(int, char**) {
   assert(!get_func().target<int>());

``````````

</details>


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


More information about the libcxx-commits mailing list