blob: 0815a037b15d2d5da3d0f25b4a6b34889e201efb [file] [log] [blame]
Douglas Gregorba0513d2011-10-25 01:33:02 +00001template<typename T>
2void f(T t) {
3 __if_exists(T::foo) {
4 { }
5 t.foo();
6 }
7
8 __if_not_exists(T::bar) {
9 int *i = t; // expected-error{{no viable conversion from 'HasFoo' to 'int *'}}
10 { }
11 }
12}
13
Douglas Gregorfd080092011-10-25 20:12:15 +000014// RUN: c-index-test -test-annotate-tokens=%s:3:1:11:3 -fms-extensions -fno-ms-compatibility -fno-delayed-template-parsing %s | FileCheck %s
Douglas Gregorba0513d2011-10-25 01:33:02 +000015
16// CHECK: Identifier: "T" [3:15 - 3:16] TypeRef=T:1:19
17// CHECK: Punctuation: "}" [4:7 - 4:8] CompoundStmt=
18// CHECK: Identifier: "t" [5:5 - 5:6] DeclRefExpr=t:2:10
19// CHECK: Punctuation: "." [5:6 - 5:7] MemberRefExpr=
20// CHECK: Identifier: "foo" [5:7 - 5:10] MemberRefExpr=
21// CHECK: Keyword: "int" [9:5 - 9:8] VarDecl=i:9:10 (Definition)
22// CHECK: Punctuation: "*" [9:9 - 9:10] VarDecl=i:9:10 (Definition)
23// CHECK: Identifier: "i" [9:10 - 9:11] VarDecl=i:9:10 (Definition)
24// CHECK: Punctuation: "=" [9:12 - 9:13] VarDecl=i:9:10 (Definition)