Richard Smith | 8f8f05c | 2013-06-24 04:45:28 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Rafael Espindola | 925213b | 2013-07-04 16:16:58 +0000 | [diff] [blame^] | 2 | // RUN: not %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: not %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 |
Richard Smith | 8f8f05c | 2013-06-24 04:45:28 +0000 | [diff] [blame] | 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 Smith | bf78e64 | 2013-06-24 22:51:00 +0000 | [diff] [blame] | 9 | template<typename, char> struct Tmpl_T_C {}; |
| 10 | template<typename, int, int> struct Tmpl_T_I_I {}; |
| 11 | |
| 12 | template<typename A, typename B, A> struct Tmpl_T_T_A {}; |
| 13 | template<typename A, typename B, B> struct Tmpl_T_T_B {}; |
| 14 | |
Richard Smith | 8f8f05c | 2013-06-24 04:45:28 +0000 | [diff] [blame] | 15 | void g() { |
| 16 | f(0); |
| 17 | f<double>(1.0); |
| 18 | f<int>(); |
| 19 | f(); // expected-error {{no matching function}} |
Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 20 | // expected-note@Inputs/cxx-templates-b.h:3 {{couldn't infer template argument}} |
| 21 | // expected-note@Inputs/cxx-templates-b.h:4 {{requires single argument}} |
Richard Smith | 8f8f05c | 2013-06-24 04:45:28 +0000 | [diff] [blame] | 22 | |
| 23 | N::f(0); |
| 24 | N::f<double>(1.0); |
| 25 | N::f<int>(); |
| 26 | N::f(); // expected-error {{no matching function}} |
Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 27 | // expected-note@Inputs/cxx-templates-a.h:6 {{couldn't infer template argument}} |
| 28 | // expected-note@Inputs/cxx-templates-a.h:7 {{requires 1 argument, but 0 were provided}} |
Richard Smith | bf78e64 | 2013-06-24 22:51:00 +0000 | [diff] [blame] | 29 | |
| 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}} |
Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 34 | // expected-note@Inputs/cxx-templates-a.h:11 {{invalid explicitly-specified argument}} |
| 35 | // expected-note@Inputs/cxx-templates-b.h:11 {{invalid explicitly-specified argument}} |
Richard Smith | bf78e64 | 2013-06-24 22:51:00 +0000 | [diff] [blame] | 36 | |
| 37 | template_param_kinds_2<Tmpl_T_I_I>(); // expected-error {{ambiguous}} |
Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 38 | // expected-note@Inputs/cxx-templates-a.h:11 {{candidate}} |
| 39 | // expected-note@Inputs/cxx-templates-b.h:11 {{candidate}} |
Richard Smith | bf78e64 | 2013-06-24 22:51:00 +0000 | [diff] [blame] | 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}} |
Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 44 | // expected-note@Inputs/cxx-templates-a.h:12 {{candidate}} |
| 45 | // expected-note@Inputs/cxx-templates-b.h:12 {{candidate}} |
Richard Smith | bf78e64 | 2013-06-24 22:51:00 +0000 | [diff] [blame] | 46 | template_param_kinds_3<Tmpl_T_T_B>(); // expected-error {{ambiguous}} |
Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 47 | // expected-note@Inputs/cxx-templates-a.h:12 {{candidate}} |
| 48 | // expected-note@Inputs/cxx-templates-b.h:12 {{candidate}} |
Richard Smith | 8f8f05c | 2013-06-24 04:45:28 +0000 | [diff] [blame] | 49 | } |
| 50 | |
Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 51 | @import cxx_templates_common; |
| 52 | |
| 53 | typedef SomeTemplate<int*> SomeTemplateIntPtr; |
| 54 | typedef SomeTemplate<int&> SomeTemplateIntRef; |
| 55 | SomeTemplate<char*> some_template_char_ptr; |
| 56 | SomeTemplate<char&> some_template_char_ref; |
| 57 | |
Richard Smith | 8f8f05c | 2013-06-24 04:45:28 +0000 | [diff] [blame] | 58 | // FIXME: There should only be two 'f's here. |
| 59 | // CHECK-GLOBAL: DeclarationName 'f' |
| 60 | // CHECK-GLOBAL-NEXT: |-FunctionTemplate {{.*}} 'f' |
| 61 | // CHECK-GLOBAL-NEXT: |-FunctionTemplate {{.*}} 'f' |
| 62 | // CHECK-GLOBAL-NEXT: |-FunctionTemplate {{.*}} 'f' |
Richard Smith | 8f8f05c | 2013-06-24 04:45:28 +0000 | [diff] [blame] | 63 | // CHECK-GLOBAL-NEXT: `-FunctionTemplate {{.*}} 'f' |
| 64 | |
| 65 | // FIXME: There should only be two 'f's here. |
| 66 | // CHECK-NAMESPACE-N: DeclarationName 'f' |
| 67 | // CHECK-NAMESPACE-N-NEXT: |-FunctionTemplate {{.*}} 'f' |
| 68 | // CHECK-NAMESPACE-N-NEXT: |-FunctionTemplate {{.*}} 'f' |
| 69 | // CHECK-NAMESPACE-N-NEXT: |-FunctionTemplate {{.*}} 'f' |
| 70 | // CHECK-NAMESPACE-N-NEXT: `-FunctionTemplate {{.*}} 'f' |