aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaCXX/cxx14-compat.cpp
blob: d6396a7de4df71e9d05c0e527f2a342ec4a94844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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; for compatibility, use explicit type name 'X<>'}}

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