Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to compile on Windows x86 with Clang #46

Open
AsakuraMizu opened this issue Aug 26, 2020 · 2 comments
Open

Fails to compile on Windows x86 with Clang #46

AsakuraMizu opened this issue Aug 26, 2020 · 2 comments

Comments

@AsakuraMizu
Copy link

/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.

@samhocevar samhocevar changed the title Fails to compile on Windows x86 Fails to compile on Windows x86 with Clang Sep 4, 2020
@samhocevar
Copy link
Owner

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)() = []() { };

@samhocevar
Copy link
Owner

Here is the related clang-cl issue: https://bugs.llvm.org/show_bug.cgi?id=38285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants