Clang Project

clang_source_code/test/SemaCXX/instantiate-template-fatal-error.cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
2
3#pragma clang diagnostic fatal "-Wall"
4#pragma clang diagnostic fatal "-Wold-style-cast"
5
6template <class T> bool foo0(const long long *a, T* b) {
7  return a == (const long long*)b; // expected-error {{use of old-style cast}}
8}
9
10template<class T>
11struct S1 {
12};
13
14template<class T>
15struct S2 : S1<T> {
16  bool m1(const long long *a, T *b) const { return foo0(a, b); }
17};
18
19bool foo1(const long long *a, int *b) {
20  S2<int> s2;
21  return s2.m1(a, b);
22}
23