view gcc/testsuite/g++.dg/parse/access4.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile }

// Origin: Mike Reed <mike.reed@amadron.com>

// PR c++/11174: Access checking of pointer-to-member function

class A {
protected:
  void foo() {}			// { dg-message "protected" }
public:
  A();
};

class B : public A {
  void bar() {
    A a;
    void (A::*pmf)() = &A::foo;	// { dg-error "this context" }
    (a.*pmf)();
  }
};