-
Notifications
You must be signed in to change notification settings - Fork 46
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
tests/misc: check sealed vs. local/global #363
base: main
Are you sure you want to change the base?
Conversation
7eea080
to
bd10ac1
Compare
bd10ac1
to
d62b3dc
Compare
tests/misc-test.cc
Outdated
TEST_EQUAL(oLocal1.type(), | ||
o.type(), | ||
"Loading global sealed cap through non-LoadGlobal bad type"); | ||
TEST_EQUAL(static_cast<PermissionSet>(oLocal1.permissions()), |
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.
I had to add this cast in the same situation recently and it is slightly annoying. Could we have an implicit conversion or is that a bad idea? You can also get rid of if you make oLocal1
const
as there is a const
version of the permissions
method that returns a PermissionSet
.
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.
The conversion is already there:
cheriot-rtos/sdk/include/cheri.hh
Lines 625 to 631 in de2db17
/** | |
* Implicitly convert to a permission set. | |
*/ | |
operator PermissionSet() const | |
{ | |
return permission_set_from_pointer(ptr()); | |
} |
Type deduction does not consider implicit conversions (other than type adjustments listed above): that's the job for overload resolution, which happens later.
So after type deduction, there's nothing that could define DebugFormatArgumentAdaptor<CHERI::Capability<void>::PermissionsProxy>
, and so overload resolution has an empty set of options to consider. AIUI, the static_cast
explicitly invokes the implicit conversion, and the const
option changes the overload resolution behavior of .permissions()
, since the const
-qualified option is more specific. Blech.
This pattern shows up in a few places.
d62b3dc
to
034abd7
Compare
No description provided.