With MSVC 14, I see this compilation error: source='../../gltests/test-oset-c++.cc' object='test-oset-c++.obj' libtool=no \ DEPDIR=.deps depmode=msvc7 /bin/sh ../../build-aux/depcomp \ /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib -D_WIN32_WINNT=_WIN32_WINNT_WIN7 -I/usr/local/msvc64/include -MD -c -o test-oset-c++.obj `cygpath -w '../../gltests/test-oset-c++.cc'` test-oset-c++.cc ../../gltests/../gllib\gl_oset.hh(162): fatal error C1001: An internal error has occurred in the compiler. (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\template.cpp', line 9012) To work around this problem, try simplifying or changing the program near the locations listed above. Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information ../../gltests/../gllib\gl_oset.hh(178): note: see reference to class template instantiation 'gl_OSet<ELTYPE*>::iterator' being compiled ../../gltests/../gllib\gl_oset.hh(196): note: see reference to class template instantiation 'gl_OSet<ELTYPE*>' being compiled make[4]: *** [Makefile:23325: test-oset-c++.obj] Error 2
This patch fixes it. 2022-09-04 Bruno Haible <br...@clisp.org> oset-c++: Fix compilation error with MSVC 14. * lib/gl_oset.hh: With MSVC, avoid 'friend'. diff --git a/lib/gl_oset.hh b/lib/gl_oset.hh index 4fae4eb4d6..d0844638b7 100644 --- a/lib/gl_oset.hh +++ b/lib/gl_oset.hh @@ -153,7 +153,7 @@ public: ~iterator () { gl_oset_iterator_free (&_state); } - #if defined __xlC__ || defined __HP_aCC || defined __SUNPRO_CC || defined __EDG__ + #if defined __xlC__ || defined __HP_aCC || defined __SUNPRO_CC || defined __EDG__ || (defined _MSC_VER && !defined __clang__) public: #else private: