diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-05-21 21:38:12 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-05-21 21:38:12 +0000 |
| commit | c2607b9a08752197a10af168a60222899f02174b (patch) | |
| tree | 055dcef23286a3c4f103b0cde3f357809e8498d7 /clang/test/SemaTemplate/instantiate-expr-4.cpp | |
| parent | 122660eb190b56841d88d86a94fe1331a5540da1 (diff) | |
| download | bcm5719-llvm-c2607b9a08752197a10af168a60222899f02174b.tar.gz bcm5719-llvm-c2607b9a08752197a10af168a60222899f02174b.zip | |
Template instantiation for initializer lists
llvm-svn: 72229
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-expr-4.cpp')
| -rw-r--r-- | clang/test/SemaTemplate/instantiate-expr-4.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-expr-4.cpp b/clang/test/SemaTemplate/instantiate-expr-4.cpp index 5c32d8c1976..09d574176ac 100644 --- a/clang/test/SemaTemplate/instantiate-expr-4.cpp +++ b/clang/test/SemaTemplate/instantiate-expr-4.cpp @@ -150,3 +150,31 @@ struct is_pod { static const int is_pod0[is_pod<X>::value? -1 : 1]; static const int is_pod1[is_pod<Y>::value? 1 : -1]; + +// --------------------------------------------------------------------- +// initializer lists +// --------------------------------------------------------------------- +template<typename T, typename Val1> +struct InitList1 { + void f(Val1 val1) { + T x = { val1 }; + } +}; + +struct APair { + int *x; + const float *y; +}; + +template struct InitList1<int[1], float>; +template struct InitList1<APair, int*>; + +template<typename T, typename Val1, typename Val2> +struct InitList2 { + void f(Val1 val1, Val2 val2) { + T x = { val1, val2 }; // expected-error{{incompatible}} + } +}; + +template struct InitList2<APair, int*, float*>; +template struct InitList2<APair, int*, double*>; // expected-note{{instantiation}} |

