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

Catch2 Error: A type specifier is required for all declarations #21865

Open
SaraBaradaran opened this issue Apr 30, 2024 · 1 comment
Open

Catch2 Error: A type specifier is required for all declarations #21865

SaraBaradaran opened this issue Apr 30, 2024 · 1 comment

Comments

@SaraBaradaran
Copy link

I tried to build magic_enum in WebAssembly using Emscripten. However, it raised an error related to Catch2. I'm not sure what the problem is. magic_enum can be compiled to x86-64 using the same version of Clang that Emscripten 3.1.54 uses.

Emscripten version 3.1.54

This is the error message I received when compiling magic_enum:

/home/magic_enum/test/3rdparty/Catch2/include/catch2/catch.hpp:10754:28: error: a type specifier is required for all declarations
10754 |     FatalConditionHandler::engage_platform() {}

You can reproduce the error using the commands below:

git clone https://github.com/Neargye/magic_enum --recursive
cd magic_enum
mkdir build
cd build
emcmake cmake -DMAGIC_ENUM_OPT_BUILD_TESTS=ON ..
emmake make
@sbc100
Copy link
Collaborator

sbc100 commented Apr 30, 2024

I imagine what is happening is that those lines around line 10754 are not very well tested and are not being compiled on the native compile because CATCH_CONFIG_POSIX_SIGNALS is being set:

#if !defined( CATCH_CONFIG_WINDOWS_SEH ) && !defined( CATCH_CONFIG_POSIX_SIGNALS )
                                                                                 
namespace Catch {                                                                
                                                                                 
    // If neither SEH nor signal handling is required, the handler impls            
    // do not have to do anything, and can be empty.                                
    FatalConditionHandler::engage_platform() {}                                  
    FatalConditionHandler::disengage_platform() {}                               
    FatalConditionHandler::FatalConditionHandler() = default;                    
    FatalConditionHandler::~FatalConditionHandler() = default;                   
                                                                                 
} // end namespace Catch                                                         
                                                                                    
#endif // !CATCH_CONFIG_WINDOWS_SEH && !CATCH_CONFIG_POSIX_SIGNALS  

Those first two lines there looks like they are probably not valid and should have void at the start.

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