Skip to content

gcc 9.2 warning (-Wcast-function-type) on MSYS2 #38

Closed
@phlptp

Description

@phlptp

Describe the bug
warning in gcc 9.2 on MSYS2 environment

C:/msys64/home/phlpt/HELICS/build_gcc/include/helics_cxx/helics/external/filesystem.hpp: In function 'void ghc::filesystem::detail::create_symlink(const ghc::filesystem::path&, const ghc::filesystem::path&, bool, std::error_code&)':
C:/msys64/home/phlpt/HELICS/build_gcc/include/helics_cxx/helics/external/filesystem.hpp:1605:159: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'ghc::filesystem::detail::CreateSymbolicLinkW_fp' {aka 'unsigned char (*)(const wchar_t*, const wchar_t*, long unsigned int)'} [-Wcast-function-type]
 1605 |     static CreateSymbolicLinkW_fp api_call = reinterpret_cast<CreateSymbolicLinkW_fp>(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "CreateSymbolicLinkW"));
      |                                                                                                                                                               ^

To Reproduce
Detailed steps to reproduce the behavior.

Expected behavior
It would be nice if the code were warning free

Additional context
MSYS2, gcc 9.2 compiler --std=c++14, most warnings turned on.
Tried with the latest release, but that didn't clear up the warning.

Metadata

Metadata

Assignees

Labels

available on masterFix is done on master branch, issue closed on next release

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions