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
    {
    public:
        static const int NOPOS=-1;
        int a;
    };
     
    class Test2
    {
    public:
        const int NOPOS=-1;
        int a;
    };
     
    int main()
    {
        std::list<Test1> list1;
        Test1 t11;
        list1.push_back(t11);
        Test1 t12;
        list1.push_back(t12);
     
        std::list<Test2> list2;
        Test2 t21;
        list2.push_back(t21);
        Test2 t22;
        list2.push_back(t22);
     
        return 0;
    

    0_1498671545996_debug.jpg


  • Lifetime Qt Champion

    Hi,

    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.



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