[Xapian-tickets] [Xapian] #806: Project does not compile on VS2019 with C++20 turned on

Xapian nobody at xapian.org
Wed Dec 23 21:17:54 GMT 2020


#806: Project does not compile on VS2019 with C++20 turned on
--------------------------+--------------------------------------
 Reporter:  Mateusz Pusz  |             Owner:  Olly Betts
     Type:  defect        |            Status:  new
 Priority:  normal        |         Milestone:  1.4.18
Component:  Other         |           Version:  1.4.16
 Severity:  normal        |        Resolution:
 Keywords:                |        Blocked By:
 Blocking:                |  Operating System:  Microsoft Windows
--------------------------+--------------------------------------
Changes (by Olly Betts):

 * version:  1.4.17 => 1.4.16

Comment:

 (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.
-- 
Ticket URL: <https://trac.xapian.org/ticket/806#comment:4>
Xapian <https://xapian.org/>
Xapian


More information about the Xapian-tickets mailing list