mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
AK+Everywhere: Disallow returning a reference from a fallible expression
This will silently make a copy. Rather than masking this behavior, let's explicitly disallow it.
This commit is contained in:
parent
3de75f6436
commit
afc0e461e1
11 changed files with 86 additions and 54 deletions
|
@ -53,6 +53,9 @@ private:
|
|||
return (capability)->promise(); \
|
||||
} \
|
||||
\
|
||||
static_assert(!IsLvalueReference<decltype(_temporary_try_or_reject_result.release_value())>, \
|
||||
"Do not return a reference from a fallible expression"); \
|
||||
\
|
||||
/* 2. Else if value is a Completion Record, set value to value.[[Value]]. */ \
|
||||
_temporary_try_or_reject_result.release_value(); \
|
||||
})
|
||||
|
@ -76,6 +79,9 @@ private:
|
|||
return Value { (capability)->promise() }; \
|
||||
} \
|
||||
\
|
||||
static_assert(!IsLvalueReference<decltype(_temporary_try_or_reject_result.release_value())>, \
|
||||
"Do not return a reference from a fallible expression"); \
|
||||
\
|
||||
/* 2. Else if value is a Completion Record, set value to value.[[Value]]. */ \
|
||||
_temporary_try_or_reject_result.release_value(); \
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue