Important: Please read the Qt Code of Conduct -

Why list objects with static members not accessible during debug

  • Hello,

    I have been struggling to debug a large code using std::list extensively. It seems that objects in a list are not accessible in the debugger using Creator if they contain a static member. I tried various version including the latest 4.3.0.

    I managed to distil the problem to the below example. As shown in the attached image, objects of Test1 are labelled <not accessible>, whilst Test2 are fine inside the list. Objects outside of the list are accessible independently from having a static member or not.

    Any help would be greatly appreciated.

    #include <iostream>
    #include <list>
    class Test1
        static const int NOPOS=-1;
        int a;
    class Test2
        const int NOPOS=-1;
        int a;
    int main()
        std::list<Test1> list1;
        Test1 t11;
        Test1 t12;
        std::list<Test2> list2;
        Test2 t21;
        Test2 t22;
        return 0;


  • Lifetime Qt Champion


    Sounds like you may have found something.

    Which version of Qt are you running ? On what OS ?

  • Hi,

    It is the latest creator 4.3.0. I tried it with Qt5.3.1 and 5.9.1 so I assume all version in between at least. The OS is Win10.

  • Lifetime Qt Champion

    Did you also check with Qt Creator 4.3.1

  • I have now. It was not out when I did the original test. Anyway with Creator 4.3.1 it seems to be OK independently from the compiler or Qt version. I guess this solves it. Thanks for pointing out.