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

S1172: Fix false positive with template specialization

    Details

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

      Description

      template<typename T> T mayUseArg( const T& t) { // this does not raise an issue
        return t==0?0:1;
      }
      
      // this should not raise an issue as it needs to follow the main template signature
      template<> int mayUseArg<int>( const int& i) { 
        return 0;
      }
      
      int mayUseArg2( const int& i) { // this raises an issue
        return 1;
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                amelie.renard Amélie Renard
                Reporter:
                geoffray.adde Geoffray Adde
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: