-
Notifications
You must be signed in to change notification settings - Fork 207
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
c++ apply integer conversions add tests #284
c++ apply integer conversions add tests #284
Conversation
Currently type of parameters of instantiated template function is ignored while preparing activation record, which makes constexpr evaluation of instantiated body use types of arguments in function call expression instead: template<typename T> bool f(T t) { return t > 0; } t<unsigned int>(-1); // CDT returns false because conversion is not done Fix this by applying EvalTypeId to argument if cost of standard conversions is Rank.CONVERSION to make sure createActivationRecord() would populate activation record with argument values matching template parameter types.
4d45445
to
79a9018
Compare
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.
Thanks for this move in the right direction.
[...] where integer conversions are missing (e.g. I did not looked at C code at all.)
It is ok by me that these other cases aren't done. I am glad you are able to move your use case forward.
PS I am quite curious about your use case as this code hasn't gotten any love for a while it is interesting to me to know who and why someone is investing time in it.
Thanks @jonahgraham Well there is nothing major behind this at the moment - I'm just using CDT to explore various code bases (both C and C++) for ages now, some of those projects recently moved to C++20, cdt.cloud is not ready yet and I cannot find anything about ongoing LSP integration efforts - looks like that stalled. So I decided to add a few missing features to CDT which would in short term unblock browsing c++20 code to some extent, and part of that is correct constexpr evaluations. LSP integration looks more future-proof but I do not see anyone doing that for CDT at the moment. |
This change fixes a few places where integer conversion was missing, and adds a few tests using corrected evaluation results.
I do use these primarily for constexpr evaluations in CDT UI so there are probably more cases where integer conversions are missing (e.g. I did not looked at C code at all.)