portable-file-dialogs
portable-file-dialogs copied to clipboard
Fails to compile on Windows x86 with Clang
/defpfd/src/portable-file-dialogs.h
Line 1325: In file included from upload/defpfd/src/button.cpp:1:
In file included from upload/defpfd/src/button.h:5:
no viable conversion from '(lambda at upload/defpfd/src/portable-file-dialogs.h:1325:42)' to 'ENUMRESNAMEPROCA' (aka 'int (*)(HINSTANCE__ *, const char *, char *, long) __attribute__((stdcall))')
ENUMRESNAMEPROC icon_enum_callback = [](HMODULE, LPCTSTR, LPTSTR lpName, LONG_PTR lParam) -> BOOL
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Source project: https://github.com/phi-x/defpfd/tree/221863e44920134cce5c7bbfb74f32f8c0dd041e
Full compilation log:
clang++ -target i386-pc-win32-msvc -m32 -g -gcodeview -DDLIB_LOG_DOMAIN="DEFPFD" -DDM_PLATFORM_WINDOWS -DLUA_BYTECODE_ENABLE_32 -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D__STDC_LIMIT_MACROS -DWINVER=0x0600 -DWIN32 -O2 -Wall -Werror=format -fvisibility=hidden -isystem /opt/platformsdk/Win32/MicrosoftVisualStudio2019/VC/Tools/MSVC/14.25.28610//atlmfc/include -isystem /opt/platformsdk/Win32/WindowsKits/10//Include/10.0.18362.0/ucrt -isystem /opt/platformsdk/Win32/WindowsKits/10//Include/10.0.18362.0/winrt -isystem /opt/platformsdk/Win32/WindowsKits/10//Include/10.0.18362.0/um -isystem /opt/platformsdk/Win32/WindowsKits/10//Include/10.0.18362.0/shared -Iupload/defpfd/include -Iupload/ -I/var/extender/sdk/dedf1ed10d96c92df6e361f5494531c79af4c1cf/defoldsdk//include -I/var/extender/sdk/dedf1ed10d96c92df6e361f5494531c79af4c1cf/defoldsdk//sdk/include upload/defpfd/src/button.cpp -c -o build/button.cpp_0.o
In file included from upload/defpfd/src/button.cpp:1:
In file included from upload/defpfd/src/button.h:5:
upload/defpfd/src/portable-file-dialogs.h:1325:21: error: no viable conversion from '(lambda at upload/defpfd/src/portable-file-dialogs.h:1325:42)' to 'ENUMRESNAMEPROCA' (aka 'int (*)(HINSTANCE__ *, const char *, char *, long) __attribute__((stdcall))')
ENUMRESNAMEPROC icon_enum_callback = [](HMODULE, LPCTSTR, LPTSTR lpName, LONG_PTR lParam) -> BOOL
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
upload/defpfd/src/portable-file-dialogs.h:1325:42: note: candidate function
ENUMRESNAMEPROC icon_enum_callback = [](HMODULE, LPCTSTR, LPTSTR lpName, LONG_PTR lParam) -> BOOL
^
upload/defpfd/src/portable-file-dialogs.h:1411:26: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
m_async->start_func([this, text, title, style](int* exit_code) -> std::string
^~~~~
In file included from upload/defpfd/src/button.cpp:1:
In file included from upload/defpfd/src/button.h:4:
In file included from /var/extender/sdk/dedf1ed10d96c92df6e361f5494531c79af4c1cf/defoldsdk//include/dmsdk/sdk.h:35:
In file included from /var/extender/sdk/dedf1ed10d96c92df6e361f5494531c79af4c1cf/defoldsdk//include/dmsdk/vectormath/cpp/vectormath_aos.h:40:
/var/extender/sdk/dedf1ed10d96c92df6e361f5494531c79af4c1cf/defoldsdk//include/dmsdk/vectormath/cpp/../scalar/cpp/vectormath_aos.h:63:11: warning: private field 'd' is not used [-Wunused-private-field]
float d;
^
/var/extender/sdk/dedf1ed10d96c92df6e361f5494531c79af4c1cf/defoldsdk//include/dmsdk/vectormath/cpp/../scalar/cpp/vectormath_aos.h:607:11: warning: private field 'd' is not used [-Wunused-private-field]
float d;
^
3 warnings and 1 error generated.
Windows x86_64 is ok.
This looks like an issue with the version of Clang shipped with Visual Studio. The following code compiles on x64 but not on x86:
void (__stdcall* foo)() = []() { };
Here is the related clang-cl issue: https://bugs.llvm.org/show_bug.cgi?id=38285