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

[MSVC][x86] Failed to build with error C2488 'naked' can only be applied to non-member function definitions #58

Open
NEIL-smtg opened this issue Jul 5, 2024 · 0 comments

Comments

@NEIL-smtg
Copy link

NEIL-smtg commented Jul 5, 2024

Description:

Note:
To reproduce this, you'll need wait for VS 2022 17.12 Preview or later version to ship which will contain this change.

Recently, we have been building this project using the latest build of MSVC, and we have encountered the following error:

Serious-Engine\Sources\Engine\Base\CTString.cpp(511,35):
error C2488: 'CTString::ScanF': 'naked' can only be applied to non-member function definitions

Reproduction Step

  1. git clone https://github.com/Croteam-official/Serious-Engine.git
  2. cd /d C:\gitP\Croteam-official\Serious-Engine\Sources
  3. msbuild /p:Platform=Win32 /p:Configuration=Release /p:PlatformToolset=v143 All.sln /t:Rebuild /m /p:BuildInParallel=true 2>&1

Expected Behavior

It compiles.

Actual result

Serious-Engine\Sources\Engine\Base\CTString.cpp(511,35): 
error C2488: 'CTString::ScanF': 'naked' can only be applied to non-member function definitions

Complete build log:
Build.log

Other information

This is the narrowed down repro, test.cpp:

struct Foo {
    __declspec(naked) void func1() {} // gets C2488
    void func2();
    __declspec(naked) static void func3() {} // gets C2488
};

__declspec(naked) void Foo::func2() {} // should also get C2488

repro command:

cl /c test.cpp

For current version, you will only ger error C2488 on line 2 and 4. For the upcoming version of VS, the last line will be also getting the error C2488.

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

1 participant