blob: d70f477cd09ac57c80db148cdc01326e17342b9e [file] [log] [blame]
Richard Smith59ef6202018-08-30 19:17:11 +00001// 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
11static_assert(true); // expected-warning {{incompatible with C++ standards before C++17}}
12
13template<int ...N> int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++17}}
14
15namespace [[]] NS_with_attr {} // expected-warning {{incompatible with C++ standards before C++17}}
16enum { e [[]] }; // expected-warning {{incompatible with C++ standards before C++17}}
17
18template<typename T = int> struct X {};
Richard Smith8eeb16f2018-09-10 20:31:03 +000019X x; // expected-warning {{class template argument deduction is incompatible with C++ standards before C++17; for compatibility, use explicit type name 'X<int>'}}
Richard Smith59ef6202018-08-30 19:17:11 +000020
21template<template<typename> class> struct Y {};
22Y<X> yx; // ok, not class template argument deduction
23
24template<typename T> void f(T t) {
25 X x = t; // expected-warning {{incompatible}}
26}
27
28template<typename T> void g(T t) {
29 typename T::X x = t; // expected-warning {{incompatible}}
30}
31struct A { template<typename T> struct X { X(T); }; };
32void h(A a) { g(a); } // expected-note {{in instantiation of}}
33
34#endif