Make the private.h header compatible with Clang.

The include/wx/msw/private.h header contains a violation of the C++
standards that MSVC tolerates but Clang/LLVM does not.

WinBase.h contains the definition:
    #define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)

Which wxWidgets uses in:
    template <wxUIntPtr INVALID_VALUE =
        (wxUIntPtr)INVALID_HANDLE_VALUE>

The (effective) reinterpret_cast-ing of INVALID_HANDLE_VALUE in
WinBase.h means that the define isn't actually usable as a constant
expression for the template parameter.

Clang has indicated they have no intention of adding an MSVC
compatibility workaround for this problem. See LLVM bug 12116:
https://bugs.llvm.org/show_bug.cgi?id=12116

Given this, rework the wxWidgets header to remove the default
template parameter value (it is not used anywhere).
With this change, it's possible to compile wxWidgets applications
using Clang/LLVM (5.0) under MSVC.
This commit is contained in:
Gian-Carlo Pascutto 2017-09-16 22:36:08 +02:00 committed by VZ
parent 33ad8063d6
commit a8b33bf08e

View File

@ -153,7 +153,7 @@ extern LONG APIENTRY
#endif
// close the handle in the class dtor
template <wxUIntPtr INVALID_VALUE = (wxUIntPtr)INVALID_HANDLE_VALUE>
template <wxUIntPtr INVALID_VALUE>
class AutoHANDLE
{
public: