Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-13128

Wrong function override resolution for const arguments

XMLWordPrintable

      If a function override accepts const and the value that is passed to it is non-const, the wrong override is resolved - it always picks the last one.

      class Foo {};
      void foo(int v) {}
      void foo(const char *v) {}
      void foo(const Foo &v) {}
      void foo(char v) {}
      
      
      void test()
      {
          foo(5);
          foo("hoo");
          foo('a');
          char *var = "var";
          foo(var); // Jumps to last override, regardless of its type
          Foo f;
          foo(f); // Jumps to last override
      }

        For Gerrit Dashboard: QTCREATORBUG-13128
        # Subject Branch Project Status CR V

            kosjar Nikolai Kosjar
            orgads Orgad Shaneh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes