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

Rule S6029: Exception specifications should be treated as part of the type

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.16
    • Component/s: C++, Rules
    • Labels:

      Description

      Starting cpp17 noexcept is part of the function prototype

      #include <utility>
      #include <functional>
      using function_type = decltype(std::declval<void (*)()noexcept>());
      void f1();
      int main() {
      	std::function<void()noexcept> fptr1 = f1; // works before c++ 17 bad
      	function_type fptr2 = (void (*)()noexcept)f1; // works even in c++17 bad
      	void (*fptr3)()noexcept = (void (*)()noexcept)f1; // works even in c++17 bad
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              amelie.renard Amélie Renard
              Reporter:
              abbas.sabra Abbas Sabra
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: