summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/constructor-template.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-08-21 18:42:58 +0000
committerDouglas Gregor <dgregor@apple.com>2009-08-21 18:42:58 +0000
commit5ed5ae476e5c7d26acf6ee1ccbcaa6b0487ceb1f (patch)
treec8e79b405689c3e354f65300e250c5ddb64665ad /clang/test/SemaTemplate/constructor-template.cpp
parentcb7444342b54411155d28f601bc6606c4969bc3f (diff)
downloadbcm5719-llvm-5ed5ae476e5c7d26acf6ee1ccbcaa6b0487ceb1f.tar.gz
bcm5719-llvm-5ed5ae476e5c7d26acf6ee1ccbcaa6b0487ceb1f.zip
Introduce support for constructor templates, which can now be declared
and will participate in overload resolution. Unify the instantiation of CXXMethodDecls and CXXConstructorDecls, which had already gotten out-of-sync. llvm-svn: 79658
Diffstat (limited to 'clang/test/SemaTemplate/constructor-template.cpp')
-rw-r--r--clang/test/SemaTemplate/constructor-template.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/constructor-template.cpp b/clang/test/SemaTemplate/constructor-template.cpp
new file mode 100644
index 00000000000..14df2e2632a
--- /dev/null
+++ b/clang/test/SemaTemplate/constructor-template.cpp
@@ -0,0 +1,24 @@
+// 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*);
+};
+
+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}}
+}
OpenPOWER on IntegriCloud