[compiler-rt] Add weak defs for .*contiguous_container.* functions (#120376)
[llvm-project.git] / clang / test / CXX / temp / temp.fct.spec / temp.deduct / temp.deduct.partial / p11.cpp
blob01155e136aad610732e96a7de7a2c2a246973637
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 template <class T> T* f(int); // #1
4 template <class T, class U> T& f(U); // #2
6 void g() {
7 int *ip = f<int>(1); // calls #1
10 template<typename T>
11 struct identity {
12 typedef T type;
15 template <class T>
16 T* f2(int, typename identity<T>::type = 0);
17 template <class T, class U>
18 T& f2(U, typename identity<T>::type = 0);
20 void g2() {
21 int* ip = f2<int>(1);
24 template<class T, class U> struct A { };
26 template<class T, class U> inline int *f3( U, A<U,T>* p = 0 ); // #1 expected-note{{candidate function [with T = int, U = int]}}
27 template< class U> inline float *f3( U, A<U,U>* p = 0 ); // #2 expected-note{{candidate function [with U = int]}}
29 void g3() {
30 float *fp = f3<int>( 42, (A<int,int>*)0 ); // Ok, picks #2.
31 f3<int>( 42 ); // expected-error{{call to 'f3' is ambiguous}}
35 namespace PR9006 {
36 struct X {
37 template <class Get>
38 int &f(char const* name, Get fget, char const* docstr = 0);
40 template <class Get, class Set>
41 float &f(char const* name, Get fget, Set fset, char const* docstr = 0);
44 void test(X x) {
45 int &ir = x.f("blah", 0, "blah");