Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-3253

S5827: False negative for list-initialized objects

    XMLWordPrintable

    Details

    • Type: False Negative
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.26
    • Fix Version/s: 6.26
    • Component/s: C++
    • Labels:
      None

      Description

      The issue is not raised if braces is used to initialize objects, while works for parenthesis. For example it the following code it is raised for x1 but not x2:

      struct Const {
        Const(int x);
      };
      
      int main() {
        Const x1 = Const(1); // CHECK :3 :8 S5827:Replace the redundant type with "auto".
        Const x2 = Const{1};
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              amelie.renard Amélie Renard
              Reporter:
              tomasz.kaminski Tomasz Kamiński
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: