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

S1110: Fix false-positive on decltype(auto) and parenthized initializer

    XMLWordPrintable

    Details

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

      Description

      The issue is raised if the parenthesised id-expr expression is used in combination with decltype(auto) type-interference. In this case removing parens has effect on the deduced type, so parenthesis are not useless.

      int x;
      decltype(auto) foo() {
         decltype(auto) y = (x); // y is int&, without parens is int
         return (x); // same as above in return type
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tomasz.kaminski Tomasz Kamiński
              Reporter:
              tomasz.kaminski Tomasz Kamiński
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: