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

Fix nodiscard warning in meta.cpp #1

Closed
wants to merge 1 commit into from
Closed

Conversation

Cheney-W
Copy link
Owner

PR Description

I'm a member of the Microsoft vcpkg team, I am submitting this Pull Request to address the compilation warning triggered by the use of the std::runtime_error constructor on line 26 of libsrc/meta.cpp. This warning is issued by the MSVC compiler (C4834) due to the discarded return value of a function with the [[nodiscard]] attribute.

It's important to note that this warning does not exist in the released versions of Visual Studio but was introduced after the recent STL PR (microsoft/STL#5174)). This change causes the compiler to issue a warning when the return value is discarded.

Specific Change:

  • Added the throw keyword to the std::runtime_error call in meta.cpp.

This change resolves the warning and ensures compatibility with the latest STL implementation. By adhering to the [[nodiscard]] attribute, this fix improves code quality and robustness.

Thank you for reviewing this PR! If there are any other changes or improvements needed, please feel free to let me know.

@Cheney-W Cheney-W closed this Dec 25, 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

Successfully merging this pull request may close these issues.

1 participant