Richard Smith | 2592327 | 2017-08-25 01:47:55 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -std=c++2a %s -verify |
2 | |||||
3 | struct X { | ||||
4 | void ref() & {} | ||||
5 | void cref() const& {} | ||||
6 | }; | ||||
7 | |||||
8 | void test() { | ||||
9 | X{}.ref(); // expected-error{{cannot initialize object parameter of type 'X' with an expression of type 'X'}} | ||||
10 | X{}.cref(); // expected-no-error | ||||
11 | |||||
12 | (X{}.*&X::ref)(); // expected-error{{pointer-to-member function type 'void (X::*)() &' can only be called on an lvalue}} | ||||
13 | (X{}.*&X::cref)(); // expected-no-error | ||||
14 | } |