cxx0x-compat.cpp revision b3df1386680b3830d2f4d300d4d7eaba134135fc
1// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wc++0x-compat -verify %s
2
3namespace N {
4  template<typename T> void f(T) {} // expected-note {{here}}
5  namespace M {
6    template void f<int>(int); // expected-warning {{explicit instantiation of 'N::f' must occur in namespace 'N'}}
7  }
8}
9
10template<typename T> void f(T) {} // expected-note {{here}}
11namespace M {
12  template void f<int>(int); // expected-warning {{explicit instantiation of 'f' must occur in the global namespace}}
13}
14
15void f() {
16  auto int n = 0; // expected-warning {{'auto' storage class specifier is redundant and incompatible with C++11}}
17}
18
19int n;
20struct S {
21  char c;
22}
23s = { n }, // expected-warning {{non-constant-expression cannot be narrowed from type 'int' to 'char' in initializer list in C++11}} expected-note {{explicit cast}}
24t = { 1234 }; // expected-warning {{constant expression evaluates to 1234 which cannot be narrowed to type 'char' in C++11}} expected-warning {{changes value}} expected-note {{explicit cast}}
25