blob: 79c8507c9c6bfc012ecf27097a576aa9bc20b90c [file] [log] [blame]
Richard Smith7b5a8bf2017-08-25 02:25:07 +00001// 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
4struct A {};
5int (A::*pa)() const&;
6int 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
13struct 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};