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

Fix false negatives in detecting the overlapping initializer list constructors in class template

    XMLWordPrintable

    Details

      Description

      Handle the overlapping constructors in template classes.
      Presently the rule ignores the classes with initializer_list constructors that are parametrized by a template argument of the class.
      It misses the following cases:

      template<typename T>
      class BNC3 { // Might be noncompliant, but ignored for simplicity
      public:
        BNC3(int a, int b);
        explicit BNC3(std::initializer_list<T> a);
      };
      
      template <typename T>
      class BNC4 { // Noncompliant, but ignored for simplicity
      public:
        BNC4(T a, T b);
        explicit BNC4(std::initializer_list<T> a);
      };
      
      template <typename T>
      class BNC5 { // Noncompliant, but ignored due to the complexity in reasoning about dependent types
      public:
        BNC5(typename T::member a, typename T::member b);
        explicit BNC5(std::initializer_list<typename T::member> a);
      };
      
      

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              arseniy.zaostrovnykh Arseniy Zaostrovnykh
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: