-
Notifications
You must be signed in to change notification settings - Fork 204
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
Add basic support for c++17 deduction guides #344
Add basic support for c++17 deduction guides #344
Conversation
e4ecc2f
to
98f5736
Compare
@ddscharfe are you interested in doing another review? @i-garrison this one is a bit bigger and I think it needs me to have more knowledge before I can review it properly. I will revisit if @ddscharfe isn't able to review. |
@i-garrison @jonahgraham I'm afraid I won't be able to find the time to review this thoroughly very soon. Maybe I can do a quick review next week, but I can't promise. |
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.
My overall impression is that this change looks of @i-garrison's standard high quality PRs. I don't quite follow all the changes as many of them are in areas I am not familiar with. I would really like it if someone at least gives it a once over and I am grateful @ddscharfe that you may have a few minutes for this.
public abstract class IndexDeductionGuideTest extends IndexBindingResolutionTestBase { | ||
private static void cxx17SetUp() { | ||
// // STD C++ parts | ||
// TestScannerProvider.sDefinedSymbols.put("__SIZEOF_SHORT__", "2"); |
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.
Why is this commented out?
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, I was not sure if it will have a lot of sense to somehow join AST2TestBase support for version-specific sets of macros but in the end only specific feature-detection was needed for new test. Cleaned this up now.
PS: This branch has conflicts that must be resolved conflicting files:
|
98f5736
to
4b99528
Compare
Rebased and fixed the conflict due to change in the same method. |
4b99528
to
2864b34
Compare
My comments so far:
|
Hi @ddscharfe what is your compiler version? I'm testing with GCC 11.3 Yes I believe deduction guides can be enabled unconditionally, but would like to understand what's wrong with feature macro first. |
Hi! I'm using gcc 8.5.0 (default on Rocky Linux 8)
I think it is not very intuitive from a usability standpoint. One could argue that they could be enabled by default and can be disabled via the macro. However I'd try to avoid the conditional statements in the parser code, but if there is a good reason to make the feature optional the way you implemented it is fine. |
I think what happens is that according to https://gcc.gnu.org/projects/cxx-status.html#cxx17 GCC 8.5 does have lower value of feature detection macro which explains why deduction guides are not enabled. We probably can lower the expected value without losing functionality though I did not checked what's changed since 8.5
Parsing the construct takes extra lookup, so this arguably should be made optional since unless parser is able to resolve the name already, lookup has to be performed even if there are no deduction guides defined. On the other hand if code does not use deduction guides then the only way to get into that extra lookup is via parser bug, otherwise name should be resolved as before this change. I can drop these conditionals together with feature macro if that would be the consensus here. I did not really looked at c++20 and later changes to deduction guides to see if feature macro test should be preserved but it would not be hard to restore it later anyway. |
I don't have a strong opinion one way or another. For a long time the CDT parser has been as unconditional as possible, meaning that some code is accepted by CDT but then rejected by the compiler. As @ddscharfe has 👍 the comment I think there is as much consensus as we'll get that we drop the conditionals. |
Enabling C++17 deduction guides unconditionally causes one of the tests for template instantiation to fail because one of instantiations can be done via implicit deduction guide using default template arguments. Test case is covering issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=207840 and remaining erroneous cases are not affected. Amend the test and comment about change since C++17.
Thanks for this discussion! I now added another change to make deduction guides unconditional (so this can be easily reverted again if needed.) There is one extra change required for unit test covering https://bugs.eclipse.org/bugs/show_bug.cgi?id=207840 discussion. One of test cases there should be amended because instantiation is done via implicit deduction guide using default template argument. |
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 have raised https://gitlab.eclipse.org/eclipsefdn/emo-team/iplab/-/issues/7922 for IP signoff as this change is > 1000 LOC.
Approved! |
No description provided.