diff options
Diffstat (limited to 'clang/test/SemaCXX/cxx98-compat.cpp')
-rw-r--r-- | clang/test/SemaCXX/cxx98-compat.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp index 8e7acf7..587c242 100644 --- a/clang/test/SemaCXX/cxx98-compat.cpp +++ b/clang/test/SemaCXX/cxx98-compat.cpp @@ -1,6 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -verify %s -// RUN: %clang_cc1 -fsyntax-only -std=c++14 -Wc++98-compat -verify %s -DCXX14COMPAT -// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++98-compat -verify %s -DCXX14COMPAT -DCXX17COMPAT +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -verify=expected,not-cpp20 %s +// RUN: %clang_cc1 -fsyntax-only -std=c++14 -Wc++98-compat -verify=expected,not-cpp20 %s -DCXX14COMPAT +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++98-compat -verify=expected,not-cpp20 %s -DCXX14COMPAT -DCXX17COMPAT +// RUN: %clang_cc1 -fsyntax-only -std=c++20 -Wc++98-compat -verify=expected,cpp20 %s -DCXX14COMPAT -DCXX17COMPAT namespace std { struct type_info; @@ -226,7 +227,8 @@ void TrivialButNonPODThroughEllipsis() { } struct HasExplicitConversion { - explicit operator bool(); // expected-warning {{explicit conversion functions are incompatible with C++98}} + // FIXME I think we should generate this diagnostic in C++20 + explicit operator bool(); // not-cpp20-warning {{explicit conversion functions are incompatible with C++98}} }; struct Struct {}; @@ -430,3 +432,12 @@ void ctad_test() { CTAD t = s; // expected-warning {{class template argument deduction is incompatible with C++ standards before C++17}} } #endif + +namespace GH161702 { +struct S { + enum E { A }; + using E::A; // expected-warning {{enumeration type in nested name specifier is incompatible with C++98}} + // not-cpp20-error@-1 {{using declaration refers to its own class}} + // cpp20-warning@-2 {{member using declaration naming non-class ''E'' enumerator is incompatible with C++ standards before C++20}} +}; +} |