This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/79687] [5/6/7 Regression] Wrong code with pointer-to-member
- From: "reichelt at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 23 Feb 2017 12:42:18 +0000
- Subject: [Bug c++/79687] [5/6/7 Regression] Wrong code with pointer-to-member
- Auto-submitted: auto-generated
- References: <bug-79687-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79687
--- Comment #11 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
The following testcase returns 1 for me since at least GCC 4.7.
clang (3.2 - 4.0.0rc2), VS (2012, 2015) and ICC all return 0.
============================================================
struct A
{
char c;
};
int main()
{
static char A::* p1 = &A::c;
char A::* const q1 = p1;
char A::* p2 = &A::c;
static char A::* const q2 = p2;
A a;
return (&(a.*q1) - &a.c) || (&(a.*q2) - &a.c) ? 1 : 0;
}
============================================================