[PATCH] Fix gnu-versioned-namespace build
Jonathan Wakely
jwakely@redhat.com
Wed Dec 11 11:22:00 GMT 2019
On 11/12/19 11:16 +0000, Jonathan Wakely wrote:
>On 11/12/19 08:29 +0100, François Dumont wrote:
>>I plan to commit this tomorrow.
>>
>>Note that rather than just adding the missing
>>_GLIBCXX_[BEGIN,END]_VERSION_NAMESPACE I also move anonymous
>>namespace usage outside std namespace. Let me know if it was
>>intentional.
>
>It was intentional, why move it?
>
>Adding the BEGIN/END_VERSION macros is unnecessary. Those namespaces
>are inline, so std::random_device already refers to
>std::__8::random_device when the original declaration was in the
>versioned namespace.
>
>The only fix needed here seems to be qualifying std::isdigit (and
>strictly-speaking we should also include <cctype> to declare that).
I was curious why that qualification is needed. Th problem is that
<ctype.h> is being indirectly included by some other header, and so is
<locale>, so the declarations visible are ::isdigit(int) and
std::__8::isdigit<CharT>(CharT, const locale&). Even after including
<cctype> we still can't call it unqualified, because <cctype> doesn't
use the versioned namespace:
namespace std
{
using ::isalnum;
using ::isalpha;
using ::iscntrl;
using ::isdigit;
In any case, I think the correct fix is to #include <cctype> and add
the std:: qualification. There should be no need to change any
namespace nesting.
More information about the Libstdc++
mailing list