-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 UIMarkdown with AuditMode #18221
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,12 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" | |
template<typename T> | ||
struct property | ||
{ | ||
explicit constexpr property(auto&&... args) : | ||
explicit constexpr property(auto&&... args) noexcept : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be something like |
||
_value{ std::forward<decltype(args)>(args)... } {} | ||
|
||
property& operator=(const property& other) = default; | ||
|
||
T operator()() const noexcept | ||
T operator()() const noexcept(noexcept(static_cast<T>(_value))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this should be |
||
{ | ||
return _value; | ||
} | ||
|
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.
This probably works, but is most likely not what you actually intended.
What
gsl::narrow
does is something like that:In other words, this will throw if there was no accurate representation as a
double
. This is easy to show with floats, because if you rungsl::narrow<float>(0xffffffff)
it'll throw as it'll actually turn into 4.2949673e9 which is nowhere near 4294967295.The solution is to just use
static_cast
.