This header is not installed for freestanding builds, so we should not
try to include it.

We could consider making std::indirect and std::polymorphic available
for freestanding, but that would be more effort as it requires
installing <bits/new_allocator.h> and other headers.

libstdc++-v3/ChangeLog:

        PR libstdc++/127476
        * include/std/memory [!_GLIBCXX_HOSTED]: Do not include
        bits/indirect.h.
---

Tested x86_64-linux (also checked with --disable-hosted-libstdcxx).

Pushed to trunk. Backport to gcc-16 needed too.

 libstdc++-v3/include/std/memory | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 0daf004fe950..aea83b6a7511 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -97,7 +97,7 @@
 #  include <bits/out_ptr.h>
 #endif
 
-#if __cplusplus > 202302L
+#if __cplusplus > 202302L && _GLIBCXX_HOSTED
 #  include <bits/indirect.h>
 #endif
 
-- 
2.56.0

Reply via email to