From MAILER-DAEMON Fri May 24 02:21:55 2019
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1hU3aV-0007Ia-Cg
	for mharc-bug-commoncpp@gnu.org; Fri, 24 May 2019 02:21:55 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38261)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <commoncpp@ryandesign.com>) id 1hU3aS-0007ID-NV
	for bug-commoncpp@gnu.org; Fri, 24 May 2019 02:21:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <commoncpp@ryandesign.com>) id 1hU3aR-0008Bs-Fp
	for bug-commoncpp@gnu.org; Fri, 24 May 2019 02:21:52 -0400
Received: from smtprelay03.ispgateway.de ([80.67.29.28]:12496)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <commoncpp@ryandesign.com>)
	id 1hU3aR-00087h-8i
	for bug-commoncpp@gnu.org; Fri, 24 May 2019 02:21:51 -0400
Received: from [67.198.113.253] (helo=untitled-mac.internal.macports.net)
	by smtprelay03.ispgateway.de with esmtpsa
	(TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1)
	(envelope-from <commoncpp@ryandesign.com>) id 1hU3aN-0002Om-92
	for bug-commoncpp@gnu.org; Fri, 24 May 2019 08:21:47 +0200
From: Ryan Schmidt <commoncpp@ryandesign.com>
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
Subject: error: use of undeclared identifier 'nullptr'
Message-Id: <F5965301-8C0F-45EC-A158-05062B4836A5@ryandesign.com>
Date: Fri, 24 May 2019 01:21:44 -0500
To: bug-commoncpp@gnu.org
X-Mailer: Apple Mail (2.3445.9.1)
X-Df-Sender: MzY4ODE4
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 80.67.29.28
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-commoncpp/>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 24 May 2019 06:21:53 -0000

Hi, ucommon 7.0.0 fails to build on Mac OS X 10.7 and 10.8 with the =
version of Apple Clang provided by Xcode. The error is:

../inc/ucommon/platform.h:552:51: error: use of undeclared identifier =
'nullptr'

Here are full build logs:

=
https://build.macports.org/builders/ports-10.7_x86_64_legacy-builder/build=
s/103277/steps/install-port/logs/stdio

=
https://build.macports.org/builders/ports-10.8_x86_64_legacy-builder/build=
s/95334/steps/install-port/logs/stdio

My understanding is that nullptr is a part of the C++11 standard. The =
default C++ standard library used on OS X 10.8 and earlier is the Apple =
GCC 4.2.1 version of libstdc++, and it does not support C++11. The =
default C++ standard library used on OS X 10.9 and later is libc++, and =
it does support C++11.

Looking at platform.h, it appears to be going to some effort to support =
pre-C++11 platforms, so I think there may just be a mistake in how it's =
handling nullptr.

The build succeeds on Mac OS X 10.6 using its Apple GCC 4.2.1 compiler. =
Apparently the build correctly detects that this platform doesn't =
support nullptr so it doesn't try to use it (or rather, it defines a =
compatibility implementation). It also succeeds on OS X 10.9 and later =
using its Apple clang compiler, where nullptr is supported.

The condition used in platform.h to decide whether to define a =
compatibility implementation of nullptr is strange to me. It says:

#if __cplusplus <=3D 199711L && !defined(_MSC_VER)
#if ...
...
#elif !defined(__clang__) || (defined(__clang__) && defined(__linux__))

This seems to suggest a belief that clang works differently on Linux =
than it does on other platforms, which is inaccurate. Clang does, =
however, work differently depending on whether the C++ standard library =
it is used with supports C++11 or not. And even when C++11 mode has not =
been requested, clang appears to support nullptr as an extension as long =
as the C++ standard library supports nullptr.

So you need a different check than "defined(__linux__)" to determine if =
the compatibility nullptr is needed for clang, since it is also needed =
in some situations on macOS. For MacPorts, I have changed =
"defined(__linux__)" to "!defined(_LIBCPP_VERSION)" but I don't know if =
this is correct for other platforms. (On macOS, I know that only libc++ =
gives us C++11 support, but other platforms might use an updated version =
of libstdc++ containing C++11 support.) I have seen it suggested that =
__has_feature(cxx_nullptr) or __has_extension(cxx_nullptr) could be =
used, but I was not able to get that to work.



In addition, I would like to draw your attention back to this previous =
bug report:

http://lists.gnu.org/archive/html/bug-commoncpp/2017-10/msg00000.html

The patch provided there still needs to be committed to your repository. =
We are using a similar patch in MacPorts.



