-
Notifications
You must be signed in to change notification settings - Fork 444
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
Convert BUG macros to constexpr variadic functions for better typing. #3774
base: main
Are you sure you want to change the base?
Conversation
lib/exceptions.h
Outdated
} // namespace Util | ||
|
||
template <class... Args> | ||
[[noreturn]] inline auto BUG(Args&&... args) { | ||
throw Util::CompilerBug(__LINE__, __FILE__, std::forward<Args>(args)...); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this alter the meaning of __LINE__
and __FILE__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and that is why C++20 adds std::source_location:
https://en.cppreference.com/w/cpp/utility/source_location
That is only there for C++20 and not in C++17 mode for GCC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this will not work with C++17 I believe. I was just getting annoyed with warnings about the BUG macros, so I wrote up this draft. Once we switch to C++20, this might be something worth considering.
This new syntax is horrid, though.
a65b46c
to
517bb52
Compare
WiP.