The test case below demonstrates the problem, as described in this PR's Comment 5:
typedef struct {
int x;
} A;
struct C : A {
int y;
};
int main()
{
C c;
return 55;
}
$ gdb a.out
(gdb) ptype C::x
Internal error: non-aggregate type to value_struct_elt_for_reference
In value_struct_elt_for_reference(), need to call check_typedef() on
the aggregate type to handle the case of *curtype being ptr->typedef.
Tested on x86_64-linux. No regressions.