Skip to content

Fix false positive on concept declaration #288

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

Merged
merged 3 commits into from
Sep 17, 2024
Merged

Fix false positive on concept declaration #288

merged 3 commits into from
Sep 17, 2024

Conversation

armandas
Copy link
Contributor

My attempt to fix #225, since #229 seems to be dead.

I used a requires keyword for concept detection, as the concept keyword could be a few lines above the opening brace.
Not 100% on the regex, so if someone could check it, I would appreciate it.

Copy link
Member

@aaronliu0130 aaronliu0130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a massive step up, though there is the very rare case of an identifier being named "requires" and the user linting a pre-C++20 file. It would be great if we could work out a way to also require the "concept" keyword, but I would be happy to merge this as-is if you can't figure it out.

@armandas
Copy link
Contributor Author

If I understand correctly, the only issue with someone using requires as a name, is it would result in }; not being detected. If my assumption is correct, I don't think it's a huge issue.

One way to go about fixing that is to go through the preceding lines and look for concept. The hard question is when to stop. Do we look for a semi-colon, empty line?

@aaronliu0130
Copy link
Member

Yeah, that's what I meant. Like I said, it's probably not really an issue if we don't see a good way..

@aaronliu0130 aaronliu0130 merged commit b29d3ee into cpplint:develop Sep 17, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C++20 concepts require a semicolon after the braces
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy