Skip to content
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

A15-1-3: Detection of duplicated exceptions on function templates #603

Open
nbusser opened this issue Jun 1, 2024 · 1 comment
Open
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Low user-report Issue reported by an end user of CodeQL Coding Standards

Comments

@nbusser
Copy link

nbusser commented Jun 1, 2024

Affected rules

  • A15-1-3

Description

When defining a function template which throws an exception, A15-1-3 warning is triggered, meaning that the exception is not unique.

Example

template <typename T>
void false_positive() {
  throw std::runtime_error{"message"}; // Triggers A15-1-3 warning
}
@nbusser nbusser added the false positive/false negative An issue related to observed false positives or false negatives. label Jun 1, 2024
@lcartey lcartey added user-report Issue reported by an end user of CodeQL Coding Standards Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address Impact-Low labels Jun 7, 2024
@lcartey
Copy link
Collaborator

lcartey commented Jun 7, 2024

Thanks for reporting!

This occurs because we have a separate representation for each template instantiation in our database representation of the program, so we consider the exception to be "duplicated" in each instantiation. The AUTOSAR rule does not clarify the expected behaviour in this case, but I believe it would be reasonable to not report this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Low user-report Issue reported by an end user of CodeQL Coding Standards
Projects
Development

No branches or pull requests

3 participants