From d224345530e3a35ee6938c666e39b57af59329ee Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 30 Aug 2018 19:17:11 +0000 Subject: [PATCH] Add test file missed from r341097. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341099 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/SemaCXX/cxx14-compat.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/SemaCXX/cxx14-compat.cpp diff --git a/test/SemaCXX/cxx14-compat.cpp b/test/SemaCXX/cxx14-compat.cpp new file mode 100644 index 0000000000..8b3dee8c82 --- /dev/null +++ b/test/SemaCXX/cxx14-compat.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++14-compat-pedantic -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++14-compat-pedantic -verify %s + +#if __cplusplus < 201402L + +// expected-no-diagnostics +// FIXME: C++11 features removed or changed in C++14? + +#else + +static_assert(true); // expected-warning {{incompatible with C++ standards before C++17}} + +template int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++17}} + +namespace [[]] NS_with_attr {} // expected-warning {{incompatible with C++ standards before C++17}} +enum { e [[]] }; // expected-warning {{incompatible with C++ standards before C++17}} + +template struct X {}; +X x; // expected-warning {{class template argument deduction is incompatible with C++ standards before C++17}} + +template class> struct Y {}; +Y yx; // ok, not class template argument deduction + +template void f(T t) { + X x = t; // expected-warning {{incompatible}} +} + +template void g(T t) { + typename T::X x = t; // expected-warning {{incompatible}} +} +struct A { template struct X { X(T); }; }; +void h(A a) { g(a); } // expected-note {{in instantiation of}} + +#endif -- 2.40.0