blob: 7d500f4896c4e423dc52dbbbe06a104eb2445f2f [file] [log] [blame]
Richard Smith8f8f05c2013-06-24 04:45:28 +00001// RUN: rm -rf %t
2// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-lookups | FileCheck %s --check-prefix=CHECK-GLOBAL
3// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-lookups -ast-dump-filter N | FileCheck %s --check-prefix=CHECK-NAMESPACE-N
4// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11
5
6@import cxx_templates_a;
7@import cxx_templates_b;
8
Richard Smithbf78e642013-06-24 22:51:00 +00009template<typename, char> struct Tmpl_T_C {};
10template<typename, int, int> struct Tmpl_T_I_I {};
11
12template<typename A, typename B, A> struct Tmpl_T_T_A {};
13template<typename A, typename B, B> struct Tmpl_T_T_B {};
14
Richard Smith8f8f05c2013-06-24 04:45:28 +000015void g() {
16 f(0);
17 f<double>(1.0);
18 f<int>();
19 f(); // expected-error {{no matching function}}
20 // expected-note@Inputs/cxx-templates-b.h:1 {{couldn't infer template argument}}
21 // expected-note@Inputs/cxx-templates-b.h:2 {{requires single argument}}
22
23 N::f(0);
24 N::f<double>(1.0);
25 N::f<int>();
26 N::f(); // expected-error {{no matching function}}
27 // expected-note@Inputs/cxx-templates-a.h:4 {{couldn't infer template argument}}
28 // expected-note@Inputs/cxx-templates-a.h:5 {{requires 1 argument, but 0 were provided}}
Richard Smithbf78e642013-06-24 22:51:00 +000029
30 template_param_kinds_1<0>(); // ok, from cxx-templates-a.h
31 template_param_kinds_1<int>(); // ok, from cxx-templates-b.h
32
33 template_param_kinds_2<Tmpl_T_C>(); // expected-error {{no matching function}}
34 // expected-note@Inputs/cxx-templates-a.h:9 {{invalid explicitly-specified argument}}
35 // expected-note@Inputs/cxx-templates-b.h:9 {{invalid explicitly-specified argument}}
36
37 template_param_kinds_2<Tmpl_T_I_I>(); // expected-error {{ambiguous}}
38 // expected-note@Inputs/cxx-templates-a.h:9 {{candidate}}
39 // expected-note@Inputs/cxx-templates-b.h:9 {{candidate}}
40
41 // FIXME: This should be valid, but we incorrectly match the template template
42 // argument against both template template parameters.
43 template_param_kinds_3<Tmpl_T_T_A>(); // expected-error {{ambiguous}}
44 // expected-note@Inputs/cxx-templates-a.h:10 {{candidate}}
45 // expected-note@Inputs/cxx-templates-b.h:10 {{candidate}}
46 template_param_kinds_3<Tmpl_T_T_B>(); // expected-error {{ambiguous}}
47 // expected-note@Inputs/cxx-templates-a.h:10 {{candidate}}
48 // expected-note@Inputs/cxx-templates-b.h:10 {{candidate}}
Richard Smith8f8f05c2013-06-24 04:45:28 +000049}
50
51// FIXME: There should only be two 'f's here.
52// CHECK-GLOBAL: DeclarationName 'f'
53// CHECK-GLOBAL-NEXT: |-FunctionTemplate {{.*}} 'f'
54// CHECK-GLOBAL-NEXT: |-FunctionTemplate {{.*}} 'f'
55// CHECK-GLOBAL-NEXT: |-FunctionTemplate {{.*}} 'f'
Richard Smith8f8f05c2013-06-24 04:45:28 +000056// CHECK-GLOBAL-NEXT: `-FunctionTemplate {{.*}} 'f'
57
58// FIXME: There should only be two 'f's here.
59// CHECK-NAMESPACE-N: DeclarationName 'f'
60// CHECK-NAMESPACE-N-NEXT: |-FunctionTemplate {{.*}} 'f'
61// CHECK-NAMESPACE-N-NEXT: |-FunctionTemplate {{.*}} 'f'
62// CHECK-NAMESPACE-N-NEXT: |-FunctionTemplate {{.*}} 'f'
63// CHECK-NAMESPACE-N-NEXT: `-FunctionTemplate {{.*}} 'f'