EAStdC icon indicating copy to clipboard operation
EAStdC copied to clipboard

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

Open NEIL-smtg opened this issue 1 year ago • 0 comments

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.

NEIL-smtg avatar Jul 05 '24 08:07 NEIL-smtg