Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / cxx14-compat.cpp
blobd6396a7de4df71e9d05c0e527f2a342ec4a94844
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
4 #if __cplusplus < 201402L
6 // expected-no-diagnostics
7 // FIXME: C++11 features removed or changed in C++14?
9 #else
11 static_assert(true); // expected-warning {{incompatible with C++ standards before C++17}}
13 template<int ...N> int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++17}}
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}}
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<>'}}
21 template<template<typename> class> struct Y {};
22 Y<X> yx; // ok, not class template argument deduction
24 template<typename T> void f(T t) {
25 X x = t; // expected-warning {{incompatible}}
28 template<typename T> void g(T t) {
29 typename T::X x = t; // expected-warning {{incompatible}}
31 struct A { template<typename T> struct X { X(T); }; };
32 void h(A a) { g(a); } // expected-note {{in instantiation of}}
34 #endif