diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-24 22:51:00 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-24 22:51:00 +0000 |
| commit | bf78e646e19110d085e6d00c0c73e50414b65708 (patch) | |
| tree | 560fd664224c0ae119fc3fa69eb500f7a9213652 /clang/test/Modules | |
| parent | 49ddb8675b5aa1396eb9e274530e880bcc917f51 (diff) | |
| download | bcm5719-llvm-bf78e646e19110d085e6d00c0c73e50414b65708.tar.gz bcm5719-llvm-bf78e646e19110d085e6d00c0c73e50414b65708.zip | |
Check for matching template-parameter-lists when merging template declarations.
llvm-svn: 184791
Diffstat (limited to 'clang/test/Modules')
| -rw-r--r-- | clang/test/Modules/Inputs/cxx-templates-a.h | 4 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/cxx-templates-b.h | 4 | ||||
| -rw-r--r-- | clang/test/Modules/cxx-templates.cpp | 26 |
3 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/cxx-templates-a.h b/clang/test/Modules/Inputs/cxx-templates-a.h index 52bc3a2e3ad..76997c7bdbc 100644 --- a/clang/test/Modules/Inputs/cxx-templates-a.h +++ b/clang/test/Modules/Inputs/cxx-templates-a.h @@ -4,3 +4,7 @@ namespace N { template<typename T> T f() { return T(); } template<typename T> T f(T); } + +template<int N> int template_param_kinds_1(); +template<template<typename T, int, int> class> int template_param_kinds_2(); +template<template<typename T, typename U, T> class> int template_param_kinds_3(); diff --git a/clang/test/Modules/Inputs/cxx-templates-b.h b/clang/test/Modules/Inputs/cxx-templates-b.h index 3cc940c2c40..c50d7059b4b 100644 --- a/clang/test/Modules/Inputs/cxx-templates-b.h +++ b/clang/test/Modules/Inputs/cxx-templates-b.h @@ -4,3 +4,7 @@ namespace N { template<typename T> T f(); template<typename T> T f(T t) { return t; } } + +template<typename> int template_param_kinds_1(); +template<template<typename, int, int...> class> int template_param_kinds_2(); +template<template<typename T, typename U, U> class> int template_param_kinds_3(); diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp index 79268127389..7d500f4896c 100644 --- a/clang/test/Modules/cxx-templates.cpp +++ b/clang/test/Modules/cxx-templates.cpp @@ -6,6 +6,12 @@ @import cxx_templates_a; @import cxx_templates_b; +template<typename, char> struct Tmpl_T_C {}; +template<typename, int, int> struct Tmpl_T_I_I {}; + +template<typename A, typename B, A> struct Tmpl_T_T_A {}; +template<typename A, typename B, B> struct Tmpl_T_T_B {}; + void g() { f(0); f<double>(1.0); @@ -20,6 +26,26 @@ void g() { N::f(); // expected-error {{no matching function}} // expected-note@Inputs/cxx-templates-a.h:4 {{couldn't infer template argument}} // expected-note@Inputs/cxx-templates-a.h:5 {{requires 1 argument, but 0 were provided}} + + template_param_kinds_1<0>(); // ok, from cxx-templates-a.h + template_param_kinds_1<int>(); // ok, from cxx-templates-b.h + + template_param_kinds_2<Tmpl_T_C>(); // expected-error {{no matching function}} + // expected-note@Inputs/cxx-templates-a.h:9 {{invalid explicitly-specified argument}} + // expected-note@Inputs/cxx-templates-b.h:9 {{invalid explicitly-specified argument}} + + template_param_kinds_2<Tmpl_T_I_I>(); // expected-error {{ambiguous}} + // expected-note@Inputs/cxx-templates-a.h:9 {{candidate}} + // expected-note@Inputs/cxx-templates-b.h:9 {{candidate}} + + // FIXME: This should be valid, but we incorrectly match the template template + // argument against both template template parameters. + template_param_kinds_3<Tmpl_T_T_A>(); // expected-error {{ambiguous}} + // expected-note@Inputs/cxx-templates-a.h:10 {{candidate}} + // expected-note@Inputs/cxx-templates-b.h:10 {{candidate}} + template_param_kinds_3<Tmpl_T_T_B>(); // expected-error {{ambiguous}} + // expected-note@Inputs/cxx-templates-a.h:10 {{candidate}} + // expected-note@Inputs/cxx-templates-b.h:10 {{candidate}} } // FIXME: There should only be two 'f's here. |

