1 | // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++14-compat-pedantic -verify %s |
2 | // RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++14-compat-pedantic -verify %s |
3 | |
4 | #if __cplusplus < 201402L |
5 | |
6 | // expected-no-diagnostics |
7 | // FIXME: C++11 features removed or changed in C++14? |
8 | |
9 | #else |
10 | |
11 | static_assert(true); // expected-warning {{incompatible with C++ standards before C++17}} |
12 | |
13 | template<int ...N> int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++17}} |
14 | |
15 | namespace [[]] NS_with_attr {} // expected-warning {{incompatible with C++ standards before C++17}} |
16 | enum { e [[]] }; // expected-warning {{incompatible with C++ standards before C++17}} |
17 | |
18 | template<typename T = int> struct X {}; |
19 | X x; // expected-warning {{class template argument deduction is incompatible with C++ standards before C++17; for compatibility, use explicit type name 'X<int>'}} |
20 | |
21 | template<template<typename> class> struct Y {}; |
22 | Y<X> yx; // ok, not class template argument deduction |
23 | |
24 | template<typename T> void f(T t) { |
25 | X x = t; // expected-warning {{incompatible}} |
26 | } |
27 | |
28 | template<typename T> void g(T t) { |
29 | typename T::X x = t; // expected-warning {{incompatible}} |
30 | } |
31 | struct A { template<typename T> struct X { X(T); }; }; |
32 | void h(A a) { g(a); } // expected-note {{in instantiation of}} |
33 | |
34 | #endif |
35 | |