-
Notifications
You must be signed in to change notification settings - Fork 417
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
Avoid pointer to reference to temporaries in SetResource
API
#733
Comments
This is not related to
There is a proposal to consider this conversion as narrowing, and so not allowed in C++20 : It seems that our default So, the problem will come wherever we use I think we need to finalize one variant type support ( #572 ), as supporting multiple variants is going to complicate the implementation. |
Same issue exists with both recent gcc (Ubuntu 20.04-LTS) and latest Visual Studio 2019 |
Repro Steps
SetResource
API).@lalitb - this is problematic spot. It won't work too well with temporaries because it's assigning a pointer to reference.
If
Resource
is compiled withstd::variant
. And a temporary is passed to API, e.g.SetResource("key", "value")
It'd break.. Sorry, I found it just now. Haven't noticed during code review originally.. :( Now I tagged the spot in review below:
#706 (comment)_
Exact Problematic Test Spot
Same issue across all 10 tests.
How to Fix
We need to avoid a pointer to temporary here. Since
Resource
values are not changing often, perhaps a copy is more appropriate than a pointer?The text was updated successfully, but these errors were encountered: