From c4234d38bdcfbad81bb653d07b6717a51f6bea1f Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Fri, 2 Sep 2022 20:07:03 +0200
Subject: [PATCH] aligned_alloc: Fix compilation error in C++ mode on Solaris
 11.

* lib/stdlib.in.h (aligned_alloc): Enable the C++ alias warning only on
glibc systems.
---
 ChangeLog       | 6 ++++++
 lib/stdlib.in.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c898c3d3ef..7896b9d31f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-02  Bruno Haible  <bruno@clisp.org>
+
+	aligned_alloc: Fix compilation error in C++ mode on Solaris 11.
+	* lib/stdlib.in.h (aligned_alloc): Enable the C++ alias warning only on
+	glibc systems.
+
 2022-09-02  Bruno Haible  <bruno@clisp.org>
 
 	getdomainname: Fix compilation error in C++ mode on Solaris 11.
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index a86643c3ca..010875803c 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -226,7 +226,7 @@ _GL_FUNCDECL_SYS (aligned_alloc, void *,
 _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
 #  endif
 # endif
-# if @HAVE_ALIGNED_ALLOC@
+# if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
 _GL_CXXALIASWARN (aligned_alloc);
 # endif
 #else
-- 
2.39.5