44 lines · cpp
1// RUN: not %clang_cc1 %s -fdiagnostics-print-source-range-info 2>&1 | FileCheck %s --strict-whitespace2 3template<typename T> class C {};4template<int> class D {};5 6void g() {7 // The range ending in the first > character does not extend to the second >8 // character.9 // CHECK: :{[[@LINE+3]]:5-[[@LINE+3]]:11}: error:10 // CHECK-NEXT: D<C<int>> a;11 // CHECK-NEXT: ^~~~~~{{$}}12 D<C<int>> a;13 14 // The range ending in the second > character does not extend to the third >15 // character.16 // CHECK: :{[[@LINE+3]]:5-[[@LINE+3]]:14}: error:17 // CHECK-NEXT: D<C<C<int>>> b;18 // CHECK-NEXT: ^~~~~~~~~{{$}}19 D<C<C<int>>> b;20}21 22template<int> int V;23// Here, we split the >>= token into a > followed by a >=.24// Then we split the >= token into a > followed by an =,25// which we merge with the other = to form an ==.26// CHECK: error: a space is required27// CHECK-NEXT: int k = V<C<int>>==0;28// CHECK-NEXT: ^~{{$}}29// CHECK-NEXT: > >{{$}}30// CHECK: error: a space is required31// CHECK-NEXT: int k = V<C<int>>==0;32// CHECK-NEXT: ^~{{$}}33// CHECK-NEXT: > ={{$}}34// CHECK: :{[[@LINE+3]]:11-[[@LINE+3]]:17}: error:35// CHECK-NEXT: int k = V<C<int>>==0;36// CHECK-NEXT: ^~~~~~{{$}}37int k = V<C<int>>==0;38 39template<typename> int W;40// CHECK: :{[[@LINE+3]]:9-[[@LINE+3]]:18}{[[@LINE+3]]:20-[[@LINE+3]]:22}: error: comparison41// CHECK-NEXT: int l = W<C<int>>==&k;42// CHECK-NEXT: ~~~~~~~~~^ ~~{{$}}43int l = W<C<int>>==&k;44