From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- .../temp.deduct/temp.deduct.partial/p11.cpp | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp (limited to 'clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp') diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp new file mode 100644 index 0000000..01155e1 --- /dev/null +++ b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template T* f(int); // #1 +template T& f(U); // #2 + +void g() { + int *ip = f(1); // calls #1 +} + +template +struct identity { + typedef T type; +}; + +template + T* f2(int, typename identity::type = 0); +template + T& f2(U, typename identity::type = 0); + +void g2() { + int* ip = f2(1); +} + +template struct A { }; + +template inline int *f3( U, A* p = 0 ); // #1 expected-note{{candidate function [with T = int, U = int]}} +template< class U> inline float *f3( U, A* p = 0 ); // #2 expected-note{{candidate function [with U = int]}} + +void g3() { + float *fp = f3( 42, (A*)0 ); // Ok, picks #2. + f3( 42 ); // expected-error{{call to 'f3' is ambiguous}} + +} + +namespace PR9006 { + struct X { + template + int &f(char const* name, Get fget, char const* docstr = 0); + + template + float &f(char const* name, Get fget, Set fset, char const* docstr = 0); + }; + + void test(X x) { + int &ir = x.f("blah", 0, "blah"); + } +} -- cgit v1.2.3