r341099 - Add test file missed from r341097.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 30 12:17:11 PDT 2018
Author: rsmith
Date: Thu Aug 30 12:17:11 2018
New Revision: 341099
URL: http://llvm.org/viewvc/llvm-project?rev=341099&view=rev
Log:
Add test file missed from r341097.
Added:
cfe/trunk/test/SemaCXX/cxx14-compat.cpp
Added: cfe/trunk/test/SemaCXX/cxx14-compat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx14-compat.cpp?rev=341099&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx14-compat.cpp (added)
+++ cfe/trunk/test/SemaCXX/cxx14-compat.cpp Thu Aug 30 12:17:11 2018
@@ -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 ...N> 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<typename T = int> struct X {};
+X x; // expected-warning {{class template argument deduction is incompatible with C++ standards before C++17}}
+
+template<template<typename> class> struct Y {};
+Y<X> yx; // ok, not class template argument deduction
+
+template<typename T> void f(T t) {
+ X x = t; // expected-warning {{incompatible}}
+}
+
+template<typename T> void g(T t) {
+ typename T::X x = t; // expected-warning {{incompatible}}
+}
+struct A { template<typename T> struct X { X(T); }; };
+void h(A a) { g(a); } // expected-note {{in instantiation of}}
+
+#endif
More information about the cfe-commits
mailing list