diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 18:03:49 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 18:03:49 +0000 |
commit | 9092c3e0fa01f3139b016d05d267a89e3b07747a (patch) | |
tree | 137ebebcae16fb0ce7ab4af456992bbd8d22fced /test/SemaTemplate/constructor-template.cpp | |
parent | 4981926bf654fe5a2c3893f24ca44106b217e71e (diff) | |
download | FreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.zip FreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.tar.gz |
Update clang to r84119.
Diffstat (limited to 'test/SemaTemplate/constructor-template.cpp')
-rw-r--r-- | test/SemaTemplate/constructor-template.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp new file mode 100644 index 0000000..acd845b --- /dev/null +++ b/test/SemaTemplate/constructor-template.cpp @@ -0,0 +1,53 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct X0 { // expected-note{{candidate}} + X0(int); // expected-note{{candidate}} + template<typename T> X0(T); + template<typename T, typename U> X0(T*, U*); + + // PR4761 + template<typename T> X0() : f0(T::foo) {} + int f0; +}; + +void accept_X0(X0); + +void test_X0(int i, float f) { + X0 x0a(i); + X0 x0b(f); + X0 x0c = i; + X0 x0d = f; + accept_X0(i); + accept_X0(&i); + accept_X0(f); + accept_X0(&f); + X0 x0e(&i, &f); + X0 x0f(&f, &i); + + X0 x0g(f, &i); // expected-error{{no matching constructor}} +} + +template<typename T> +struct X1 { + X1(const X1&); + template<typename U> X1(const X1<U>&); +}; + +template<typename T> +struct Outer { + typedef X1<T> A; + + A alloc; + + explicit Outer(const A& a) : alloc(a) { } +}; + +void test_X1(X1<int> xi) { + Outer<int> oi(xi); + Outer<float> of(xi); +} + +// PR4655 +template<class C> struct A {}; +template <> struct A<int>{A(const A<int>&);}; +struct B { A<int> x; B(B& a) : x(a.x) {} }; |