summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx2a-pointer-to-const-ref-member.cpp
blob: e9cbb1a18532f2475a7a04ef51bdad8b4446ae05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// RUN: %clang_cc1 -std=c++2a %s -verify

struct X {
  void ref() & {}
  void cref() const& {}
};

void test() {
  X{}.ref(); // expected-error{{cannot initialize object parameter of type 'X' with an expression of type 'X'}}
  X{}.cref(); // expected-no-error

  (X{}.*&X::ref)(); // expected-error-re{{pointer-to-member function type 'void (X::*)() {{.*}}&' can only be called on an lvalue}}
  (X{}.*&X::cref)(); // expected-no-error
}
OpenPOWER on IntegriCloud