blob: 0bc40c81798384969d6b4b3cc59cdc1c7864f6fc [file] [log] [blame]
Richard Smith25923272017-08-25 01:47:55 +00001// RUN: %clang_cc1 -std=c++2a %s -verify
2
3struct X {
Jacob Bandes-Storchbb935782017-12-31 18:27:29 +00004 void ref() & {} // expected-note{{'ref' declared here}}
Richard Smith25923272017-08-25 01:47:55 +00005 void cref() const& {}
6};
7
8void test() {
Jacob Bandes-Storchbb935782017-12-31 18:27:29 +00009 X{}.ref(); // expected-error{{'this' argument to member function 'ref' is an rvalue, but function has non-const lvalue ref-qualifier}}
Richard Smith25923272017-08-25 01:47:55 +000010 X{}.cref(); // expected-no-error
11
Richard Smithcae37ca2017-08-25 01:55:50 +000012 (X{}.*&X::ref)(); // expected-error-re{{pointer-to-member function type 'void (X::*)() {{.*}}&' can only be called on an lvalue}}
Richard Smith25923272017-08-25 01:47:55 +000013 (X{}.*&X::cref)(); // expected-no-error
14}