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 #17

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 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:

EASTL\test\packages\EAStdC\source\EAFixedPoint.cpp(29,30): 
error C2488: 'EA::StdC::FPTemplate<int32_t,16,16,65536,65536>::FixedMul': 'naked' can only be applied to non-member function definitions

Reproduction Step

  1. git clone https://github.com/electronicarts/EASTL.git
  2. cd EASTL\
  3. mkdir build\
  4. cd build\
  5. set CL=/Zc:static_assert-
  6. cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.22621.0 -DEASTL_BUILD_BENCHMARK:BOOL=OFF -DEASTL_BUILD_TESTS:BOOL=ON .. 2>&1
  7. msbuild /m /p:Platform=Win32 /p:Configuration=Release EASTL.sln /t:Rebuild 2>&1

Expected Behavior

It compiles.

Actual result

EASTL\test\packages\EAStdC\source\EAFixedPoint.cpp(29,30): 
error C2488: 'EA::StdC::FPTemplate<int32_t,16,16,65536,65536>::FixedMul': '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