https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79687
Bug ID: 79687
Summary: [6/7 Regression] Wrong code with pointer-to-member
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
Target Milestone: ---
The following code snippet is miscompiled since GCC 6:
======================================
struct A
{
char c;
};
int main()
{
char A::* p = &A::c;
static char A::* const q = p;
A a;
return &(a.*q) - &a.c;
}
======================================
The program should return 0, but doesn't.