We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I would like to be able to call non-const methods on a tuple member, i.e. the code below should compile:
struct Type1 { int get_num_const() const {return 1;} int get_num() {return 1;} }; int main() { using namespace boost::ut; "types"_test = []<class T>(T& t) { expect(that% t.get_num() == 2) << reflection::type_name<T>() << "failed the test"; // "Type1" failed the test. } | std::tuple{Type1{}}; }
Instead, I am getting a compile error:
<source>:19:31: error: passing 'const Type1' as 'this' argument discards qualifiers [-fpermissive] 19 | expect(that% t.get_num() == 2) << reflection::type_name<T>() << "failed the test"; | ~~~~~~~~~^~ <source>:10:9: note: in call to 'int Type1::get_num()' 10 | int get_num() {return 1;} | ^~~~~~~
At the moment, i am forced to hack the const modifier away (e.g.: auto* t1 = const_cast<std::remove_const<T>::type*>(&t))
auto* t1 = const_cast<std::remove_const<T>::type*>(&t)
Looking at the ut internals, the issue can be "fixed" by removing const modifier of the arg parameter in the following line
const
arg
ut/include/boost/ut.hpp
Line 607 in 20f2c3f
and let the user decide whether the param is being passed as a const reference or a mutable one?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Expected Behavior
I would like to be able to call non-const methods on a tuple member, i.e. the code below should compile:
Actual Behavior
Instead, I am getting a compile error:
At the moment, i am forced to hack the const modifier away (e.g.:
auto* t1 = const_cast<std::remove_const<T>::type*>(&t)
)Looking at the ut internals, the issue can be "fixed" by removing
const
modifier of thearg
parameter in the following lineut/include/boost/ut.hpp
Line 607 in 20f2c3f
and let the user decide whether the param is being passed as a const reference or a mutable one?
Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: