Hello,
We are having a hard time debugging our code base which is primarily C++ based. Class members in derived classes are shown as "outofscope" in some cases. In the following example, a.var1, a.var2, b.var1 and b.var2 are "outofscope". If A class is not instatiated, b.var1 and b.var2 are visible as expected which is strange.
C: AClass.h
#ifndef ACLASS_H
#define ACLASS_H
class AParent
{
public:
int var2;
};
class A : public AParent
{
public:
int var1;
};
#endif
Display More
C: main.cpp
#include "AClass.h"
class BParent
{
public:
int var2;
};
class B :public BParent
{
public:
int var1;
};
//If A class is not instantiated, b.var1 and b.var2 are NOT out of scope
A a;
B b;
int main(int, char *[])
{
while (1)
{
b.var1++;
b.var2++;
}
}
Display More
The issue is not present if the code is compiled with Segger Embedded Studio
Stm32F439
Ozone 3.38f
-O0
GCC toolchain 12.2 (same issue on 14.2)
https://developer.arm.com/-/media/Files/…9F9E16D17A85311
Related issue: