createrepo_c icon indicating copy to clipboard operation
createrepo_c copied to clipboard

Use of reserved C++ keyword

Open Taronyu opened this issue 5 years ago • 1 comments

In package.h the package struct contains the line GSList *requires. Since C++20 "requires" is a reserved keyword, so clang++ is complaining about it and terminates compilation of my code. I am using clang version 8.0.0 with the --std=c++2a flag. Using g++ does not lead to errors (version 9.1.0).

Since this is code that is accessible to clients of createrepo_c, changing the variable's name is probably not much of an option because of the amount of code that might break. Any tips how I can solve this?

Edit: As a quick fix I switched to using C++17

Taronyu avatar Oct 23 '19 11:10 Taronyu

FWIW you may be able to work around it using some tricks described here: https://stackoverflow.com/questions/36867325/how-to-link-old-c-code-with-reserved-keywords-in-it-with-c

lukash avatar Oct 29 '19 08:10 lukash