Richard Smith | 7b5a8bf | 2017-08-25 02:25:07 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++17 -pedantic -verify %s |
| 2 | // RUN: %clang_cc1 -fsyntax-only -std=c++2a -Wc++17-compat-pedantic -verify %s |
| 3 | |
| 4 | struct A {}; |
| 5 | int (A::*pa)() const&; |
| 6 | int use_pa = (A().*pa)(); |
| 7 | #if __cplusplus <= 201703L |
| 8 | // expected-warning@-2 {{invoking a pointer to a 'const &' member function on an rvalue is a C++2a extension}} |
| 9 | #else |
| 10 | // expected-warning@-4 {{invoking a pointer to a 'const &' member function on an rvalue is incompatible with C++ standards before C++2a}} |
| 11 | #endif |
| 12 | |
| 13 | struct B { |
| 14 | void b() { |
| 15 | (void) [=, this] {}; |
| 16 | #if __cplusplus <= 201703L |
| 17 | // expected-warning@-2 {{explicit capture of 'this' with a capture default of '=' is a C++2a extension}} |
| 18 | #else |
| 19 | // expected-warning@-4 {{explicit capture of 'this' with a capture default of '=' is incompatible with C++ standards before C++2a}} |
| 20 | #endif |
| 21 | } |
| 22 | }; |