Code completion and static code analysis gets things wrong



  • I have some issues with the static code analysis of Qt Creator not always showing me the correct data, and when I press F2 (follow symbol), I end up at the wrong place.

    For example, I have this code:

    @template<typename T> T GetMax(int a, int b)
    {
    T result;
    result = (a>b)? a : b;
    return (result);
    }

    template<typename T> T GetMax(int a, int b, int c)
    {
    T result;
    result = (a>b)? a : b;
    return (result);

    }

    int main()
    {
    int a = GetMax<int>(3, 4);
    cout << a;

    return 0;
    

    }@

    The on-mouse-over popup on the call to GetMax shows the second function signature. In fact, it always shows the last one (if I switch them around, it shows the proper one). The F2 (follow symbol) feature jumps to the wrong function as well.

    I did find "this bug":https://bugreports.qt-project.org/browse/QTCREATORBUG-10295. Is that the same problem?

    (edit: actually, it doesn't autocomplete the template functions, I can see now). -Also, the code completer don't always show the function signature of all functions. I'm working with the ODB framework now, and when I call "db->", -only some methods show the function signature on selecting it. I haven't been able to figure out the pattern to when it does, and when it doesn't. Is this possibly related to the above problem?-

    I'm using QtCreator 2.8.1, using a non Qt project.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.