diff options
Diffstat (limited to 'test/SemaCXX/cxx2a-pointer-to-const-ref-member.cpp')
-rw-r--r-- | test/SemaCXX/cxx2a-pointer-to-const-ref-member.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx2a-pointer-to-const-ref-member.cpp b/test/SemaCXX/cxx2a-pointer-to-const-ref-member.cpp new file mode 100644 index 000000000000..e9cbb1a18532 --- /dev/null +++ b/test/SemaCXX/cxx2a-pointer-to-const-ref-member.cpp @@ -0,0 +1,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 +} |