Opened 4 years ago

Closed 2 years ago

#806 closed defect (fixed)

Project does not compile on VS2019 with C++20 turned on

Reported by: Mateusz Pusz Owned by: Olly Betts
Priority: normal Milestone: 1.5.0
Component: Other Version: 1.4.16
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: Microsoft Windows

Description

There are multiple legacy code problems:

Repro: Try to compile https://conan.io/center/xapian-core on VS2019 with C++20 turned on.

Impact:

  • Conan xapian-core and doxygen packages are not available for Windows

Change History (8)

comment:1 by Olly Betts, 4 years ago

Thanks for reporting this.

The use of mem_fun I can fix, but I don't understand the byte issue.

The std::byte type was added in C++17, and we already addressed that in C++ code in changeset:f527b61a65f259ce68b11ef9d89a959f5cf62a12 which should be in 1.4.17, and indeed all releases for over 2 years:

$ git tag --contains f527b61a65f259ce68b11ef9d89a959f5cf62a12
v1.4.10
v1.4.11
v1.4.12
v1.4.13
v1.4.14
v1.4.15
v1.4.16
v1.4.17
v1.4.8
v1.4.9

There's one remaining use of typedef unsigned char byte; but that's in C code, not C++. Even if that C code gets compiled as C++ there's no #include <cstddef> or using namespace std; in that C code, so I can't see how that's a problem.

Are you definitely seeing this with 1.4.17? If so, can you show a log of the compiler errors you're getting, and also show the exact commands you're using to configure and build.

comment:2 by Olly Betts, 4 years ago

Milestone: 1.4.18

I've eliminated the only use of std::mem_fun from RELEASE/1.4 branch in changeset:50cdbee8b9ac5e22d353ccdd6abe8ada9dc60bca. That code isn't present on git master.

I think more info is needed on the std::byte issue.

If anyone needs a simple short term workaround, you can presumably set the compiler to an earlier C++ standard version using /std:c++11 or similar.

comment:3 by Mateusz Pusz, 4 years ago

Hi, thanks for a quick answer. To repro std::byte issue please run the following on a Windows machine with VS2019:

pip3 install -U conan
conan install xapian-core/1.4.16@ -s compiler.cppstd=20 -b missing

The following error is generated:

libtool: compile:  C:/Users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/msvc_cl.sh -DHAVE_CONFIG_H -I. -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/common -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/include -I./include -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/languages -Ilanguages -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/queryparser -I/c/users/mateusz_pusz/.conan/data/zlib/1.2.11/_/_/package/3fb49604f9c2f729b85ba3115852006824e72cab/include -DNDEBUG -O2 -Ob2 -MD -EHsc /std:c++latest -c -showIncludes /c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/api/replication.cc -o api/replication.obj
    Compiling source
    ** cl options:   "-DHAVE_CONFIG_H -I. -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/common -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/include -I./include -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/languages -Ilanguages -I/c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/queryparser -I/c/users/mateusz_pusz/.conan/data/zlib/1.2.11/_/_/package/3fb49604f9c2f729b85ba3115852006824e72cab/include -DNDEBUG -O2 -Ob2 -MD -EHsc /std:c++latest -c -showIncludes /c/users/mateusz_pusz/.conan/data/xapian-core/1.4.16/_/_/build/dfa2a09fc744e3c526f0a61f32a9e22cf5aa441f/source_subfolder/api/replication.cc -Foapi/replication.obj"
replication.cc
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(192): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(962): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(970): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypesbase.h(437): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypesbase.h(462): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypesbase.h(479): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypes.h(77): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypes.h(86): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypes.h(92): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypes.h(98): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypes.h(104): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypes.h(110): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypes.h(485): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h(2175): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h(2189): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h(7881): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h(7897): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(9745): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(10274): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(10306): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(10785): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(10800): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(11243): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(12976): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(12991): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(14657): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(14673): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(14820): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(14859): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(14876): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(14893): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(15138): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidl.h(15157): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\oaidl.h(563): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'
make[2]: *** [Makefile:2812: api/replication.lo] Error 1

Last edited 4 years ago by Mateusz Pusz (previous) (diff)

comment:4 by Olly Betts, 4 years ago

Version: 1.4.171.4.16

(So 1.4.16 rather than 1.4.17, but plenty recent enough for the older byte fix.)

The problem here looks to be a clash between different Microsoft headers, rather than in our code:

C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(192): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(191): note: could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\cstddef(29): note: or       'std::byte'

So that seems to say that rpcndr.h line 191 has unsigned char byte but cstddef line 29 defines std::byte.

And looking at rpcndr.h in "MinGW.org WSL-5.4.1 release" I see:

typedef unsigned char byte;

so presumably Microsoft's version has the same or equivalent.

Furthermore, there's no byte anywhere in replication.cc (the Xapian source file being compiled when we hit this). The only byte use anywhere in xapian-core is in the C code of the snowball compiler, which as I said above really shouldn't be a problem even if the snowball compiler is compiled as C++.

We don't explicitly include rpcndr.h anywhere (nearest I can see is rpc.h but that's only included by backends/uuids.cc not replication.cc), and there's only one explicit include of cstddef in api/smallvector.h which doesn't seem to be reached from replication.cc.

Thanks for providing a command to reproduce, but I don't run Microsoft Windows myself so I don't think I can usefully debug this further.

comment:5 by Mateusz Pusz, 4 years ago

I am pretty sure that this problem is caused by using namespace std; which should be avoided in the global scope and especially in header files. If you will narrow down using namespace std; to the function or block-level that needs it the problem should disappear.

comment:6 by Olly Betts, 4 years ago

The system/compiler headers really should be robust to this as it is part of the language, but it's certainly plausible there might be bugs in this area.

We do completely avoid using namespace std; in public headers, and we also aim to avoid it in internal headers, but some older headers do still have it.

Pushing it down to the block level everywhere doesn't seem workable - pretty much every function would need using namespace std; or explicit std:: qualifiers adding everywhere. But using namespace std; in non-header sources should be safe from this issue provided it's done after all headers have been included. There's still potential for clashes from additions in new C++ standard versions, but in practice these are rare and the trade-off for convenience seems worthwhile.

Can you work out which use is actually the problem here? A targetted fix seems reasonable, but I worry a mass refactor to eliminate all cases is potentially destabilising for a stable release branch.

comment:7 by Olly Betts, 4 years ago

Milestone: 1.4.18

I've removed the 10 remaining uses of using namespace std; from headers on git master in d5fb8bfde7481483e0793c08715cb84212e1b1eb, and added a check for this to the patch checking script to catch people trying to add new instances in 5a1df9067e1cd1207acee31839727955dad257b0.

However the patch to remove the uses on master is large:

33 files changed, 171 insertions(+), 168 deletions(-)

And the 1.4 branch has nearly twice as many remaining uses - eliminating them all just seems too invasive a change to make several years into a stable release branch.

As above, a targetted patch to address this is welcome, but I'm not easily able to work on one as this just isn't a platform I use.

Unsetting the milestone for now since 1.4.18 is overdue and this can presumably be worked around by just specifying a lower standards version to the compiler.

comment:8 by Olly Betts, 2 years ago

Milestone: 1.5.0
Resolution: fixed
Status: newclosed

With the changes I made before git master should build cleanly as C++20.

From CI we know xapian-core 1.4.x builds out of the box with MSVC 2015-2022, and the public API headers are already free of using namespace std; so building an application which uses xapian in C++20 mode should work fine and the only problem here is if you specifically tell the compiler to use C++20 mode when building xapian-core itself. That's self-inflicted really, and the simple workaround is not to do that. This would become more of an issue if/when there's an MSVC version which defaults to C++20, but even then specifying an older version explicitly would be an easy workaround, and I'd expect we'll have a new release series out well before then.

As above, a targetted patch to address this is welcome, but I'm not easily able to work on one as this just isn't a platform I use.

This remains true, but there's been no follow-up or feedback in 18 months so I'm going to close this ticket and mark it as fixed in 1.5.0 (the version git master will become). If someone wants to work on this we can reopen.

Note: See TracTickets for help on using tickets.