This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/79687] [5/6/7 Regression] Wrong code with pointer-to-member


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;
}
============================================================

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]