diff --git a/clang/test/SemaCXX/cxx17-compat.cpp b/clang/test/SemaCXX/cxx17-compat.cpp index 79c8507c9c6b..3b814340c6da 100644 --- a/clang/test/SemaCXX/cxx17-compat.cpp +++ b/clang/test/SemaCXX/cxx17-compat.cpp @@ -19,4 +19,11 @@ struct B { // expected-warning@-4 {{explicit capture of 'this' with a capture default of '=' is incompatible with C++ standards before C++2a}} #endif } + + int n : 5 = 0; +#if __cplusplus <= 201703L + // expected-warning@-2 {{default member initializer for bit-field is a C++2a extension}} +#else + // expected-warning@-4 {{default member initializer for bit-field is incompatible with C++ standards before C++2a}} +#endif };