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

Compilation failure with C++17 standard #114

Closed
amadio opened this issue Feb 22, 2023 · 5 comments
Closed

Compilation failure with C++17 standard #114

amadio opened this issue Feb 22, 2023 · 5 comments
Assignees

Comments

@amadio
Copy link

amadio commented Feb 22, 2023

The struct data in voms/voms_api.h clashes with std::data from C++17, and causes the compilation error below:

/usr/include/voms/voms_api.h:115:19: error: template argument 1 is invalid
  115 |   std::vector<data> std;   /*!< User's characteristics */
      |                   ^
/usr/include/voms/voms_api.h:115:19: error: template argument 2 is invalid

This bug has been found after trying to compile XRootD with support for voms with C++17 standard. The build error can be seen here.

A potential fix is to use std::vector<::data> to disambiguate, but it's also probable that std as the variable name will have to be changed as well to avoid further name clashes with the standard C++ namespace std::.

@giacomini
Copy link
Member

I have reproduced it at https://godbolt.org/z/c3e14ze9M.
Naming in VOMS is awful, but I am reluctant to make naming changes, unless there are no other solutions. However I suspect the compilation error you see is rather due to the use of using namespace std somewhere in XRootD code; I've seen several occurrences, even in header files.
In the same godbolt above you can also find an easy fix that you can apply, thanks to a well-placed using Data = ::data;. Even better, you can simply use auto dat = (*i).std;.
Let me know.

@amadio
Copy link
Author

amadio commented Feb 23, 2023

I think you are right, I searched a bit further and found a using namespace std; in XrdOucString.hh which may be the cause of the clash, as it may be indirectly included in that source file. I will try to fix this on our end first, but it's probably not a bad idea to qualify data as ::data in voms headers anyway.

@giacomini
Copy link
Member

I thought a bit more about it and indeed it would be good to qualify data in the VOMS codebase, otherwise it would break if a previously-included header file does using namespace std;.
Thanks for catching this.

@giacomini giacomini self-assigned this Feb 23, 2023
@amadio
Copy link
Author

amadio commented Mar 2, 2023

I've fixed this on our end, so please feel free to close this ticket anytime if you want. There's no bug in VOMS.

@amadio
Copy link
Author

amadio commented Jan 23, 2024

Closing, as there's no bug to actually be fixed in VOMS. Thank you!

@amadio amadio closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2024
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