int* f(int) { return 0; }
float* f(float) { return 0; }
void f();
void test_f(int iv, float fv) {
float* fp = f(fv);
int* ip = f(iv);
}
int* g(int, float, int); float* g(int, int, int);
double* g(int, float, float); char* g(int, float, ...);
void g();
void test_g(int iv, float fv) {
int* ip1 = g(iv, fv, 0);
float* fp1 = g(iv, iv, 0);
double* dp1 = g(iv, fv, fv);
char* cp1 = g(0, 0);
char* cp2 = g(0, 0, 0, iv, fv);
double* dp2 = g(0, fv, 1.5); }
double* h(double f);
int* h(int);
void test_h(float fv, unsigned char cv) {
double* dp = h(fv);
int* ip = h(cv);
}
int* i(int);
double* i(long);
void test_i(short sv, int iv, long lv, unsigned char ucv) {
int* ip1 = i(sv);
int* ip2 = i(iv);
int* ip3 = i(ucv);
double* dp1 = i(lv);
}
int* j(void*);
double* j(bool);
void test_j(int* ip) {
int* ip1 = j(ip);
}
int* k(char*);
double* k(bool);
void test_k() {
int* ip1 = k("foo");
#if __cplusplus <= 199711L
#else
#endif
int* ip2 = k(("foo"));
#if __cplusplus <= 199711L
#else
#endif
double* dp1 = k(L"foo");
}
int* l(wchar_t*);
double* l(bool);
void test_l() {
int* ip1 = l(L"foo");
#if __cplusplus <= 199711L
#else
#endif
double* dp1 = l("foo");
}
int* m(const char*);
double* m(char*);
void test_m() {
int* ip = m("foo");
}
int* n(char*);
double* n(void*);
class E;
void test_n(E* e) {
char ca[7];
int* ip1 = n(ca);
int* ip2 = n("foo");
#if __cplusplus <= 199711L
#else
#endif
float fa[7];
double* dp1 = n(fa);
double* dp2 = n(e);
}
enum PromotesToInt {
PromotesToIntValue = -1
};
enum PromotesToUnsignedInt {
PromotesToUnsignedIntValue = __INT_MAX__ * 2U
};
int* o(int);
double* o(unsigned int);
float* o(long);
void test_o() {
int* ip1 = o(PromotesToIntValue);
double* dp1 = o(PromotesToUnsignedIntValue);
}
int* p(int);
double* p(double);
void test_p() {
int* ip = p((short)1);
double* dp = p(1.0f);
}
struct Bits {
signed short int_bitfield : 5;
unsigned int uint_bitfield : 8;
};
int* bitfields(int, int);
float* bitfields(unsigned int, int);
void test_bitfield(Bits bits, int x) {
int* ip = bitfields(bits.int_bitfield, 0);
float* fp = bitfields(bits.uint_bitfield, 0u);
}
int* multiparm(long, int, long); float* multiparm(int, int, int); double* multiparm(int, int, short);
void test_multiparm(long lv, short sv, int iv) {
int* ip1 = multiparm(lv, iv, lv);
int* ip2 = multiparm(lv, sv, lv);
float* fp1 = multiparm(iv, iv, iv);
float* fp2 = multiparm(sv, iv, iv);
double* dp1 = multiparm(sv, sv, sv);
double* dp2 = multiparm(iv, sv, sv);
multiparm(sv, sv, lv); }
int* quals1(int const * p);
char* quals1(int * p);
int* quals2(int const * const * pp);
char* quals2(int * * pp);
int* quals3(int const * * const * ppp);
char* quals3(int *** ppp);
void test_quals(int * p, int * * pp, int * * * ppp) {
char* q1 = quals1(p);
char* q2 = quals2(pp);
char* q3 = quals3(ppp);
}
int* quals_rank1(int const * p);
float* quals_rank1(int const volatile *p);
char* quals_rank1(char*);
double* quals_rank1(const char*);
int* quals_rank2(int const * const * pp);
float* quals_rank2(int * const * pp);
void quals_rank3(int const * const * const volatile * p); void quals_rank3(int const * const volatile * const * p);
void quals_rank3(int const *); void quals_rank3(int volatile *);
void test_quals_ranking(int * p, int volatile *pq, int * * pp, int * * * ppp) {
int* q1 = quals_rank1(p);
float* q2 = quals_rank1(pq);
double* q3 = quals_rank1("string literal");
char a[17];
const char* ap = a;
char* q4 = quals_rank1(a);
double* q5 = quals_rank1(ap);
float* q6 = quals_rank2(pp);
quals_rank3(ppp);
quals_rank3(p); quals_rank3(pq);
}
class A { };
class B : public A { };
class C : public B { };
class D : public C { };
int* derived1(A*);
char* derived1(const A*);
float* derived1(void*);
int* derived2(A*);
float* derived2(B*);
int* derived3(A*);
float* derived3(const B*);
char* derived3(C*);
void test_derived(B* b, B const* bc, C* c, const C* cc, void* v, D* d) {
int* d1 = derived1(b);
char* d2 = derived1(bc);
int* d3 = derived1(c);
char* d4 = derived1(cc);
float* d5 = derived1(v);
float* d6 = derived2(b);
float* d7 = derived2(c);
char* d8 = derived3(d);
}
void derived4(C*);
void test_base(A* a) {
derived4(a); }
int* intref(int&);
float* intref(const int&);
void intref_test() {
float* ir1 = intref(5);
float* ir2 = intref(5.5); }
void derived5(C&);
void test_base(A& a) {
derived5(a); }
int& bind_vs_conv(const double&);
float& bind_vs_conv(int);
void bind_vs_conv_test()
{
int& i1 = bind_vs_conv(1.0f);
float& f1 = bind_vs_conv((short)1);
}
struct X { };
struct Y { };
struct Z : X, Y { };
int& cvqual_subsume(X&); float& cvqual_subsume(const Y&);
int& cvqual_subsume2(X&); float& cvqual_subsume2(volatile Y&);
void cvqual_subsume_test(Z z) {
cvqual_subsume(z); cvqual_subsume2(z); }
int& cvqual_diff(X&);
float& cvqual_diff(const X&);
void cvqual_diff_test(X x, Z z) {
int& i1 = cvqual_diff(x);
int& i2 = cvqual_diff(z);
}
struct Z2 : Z { };
int& db_rebind(X&);
long& db_rebind(Y&);
float& db_rebind(Z&);
void db_rebind_test(Z2 z2) {
float& f1 = db_rebind(z2);
}
class string { };
class opt : public string { };
struct SR {
SR(const string&);
};
void f(SR) { }
void g(opt o) {
f(o);
}
namespace PR5756 {
int &a(void*, int);
float &a(void*, float);
void b() {
int &ir = a(0,0);
(void)ir;
}
}
namespace test1 {
template <class T>
void foo(T t, unsigned N); void foo(int n, char N); void foo(int n, const char *s, int t); void foo(int n, const char *s, int t, ...); void foo(int n, const char *s, int t, int u = 0);
void foo(int n); void foo(unsigned n = 10); void bar(int n, int u = 0); void baz(int n = 0, int u = 0);
void test() {
foo(4, "hello"); bar(); baz(3, 4, 5); }
}
namespace test2 {
struct QFixed {
QFixed(int i);
QFixed(long i);
};
bool operator==(const QFixed &f, int i);
class qrgb666 {
inline operator unsigned int () const;
inline bool operator==(const qrgb666 &v) const;
inline bool operator!=(const qrgb666 &v) const { return !(*this == v); }
};
}
namespace IncompleteConversion {
struct Complete {};
struct Incomplete;
void completeFunction(Complete *); void completeFunction(Complete &);
void testTypeConversion(Incomplete *P) {
completeFunction(P); completeFunction(*P); }
void incompletePointerFunction(Incomplete *); void incompleteReferenceFunction(Incomplete &);
void testPointerReferenceConversion(Incomplete &reference, Incomplete *pointer) {
incompletePointerFunction(reference); incompleteReferenceFunction(pointer); }
}
namespace DerivedToBaseVsVoid {
struct A { };
struct B : A { };
float &f(void *);
int &f(const A*);
void g(B *b) {
int &ir = f(b);
}
}
namespace test4 {
class A;
class B {
static void foo(); static void foo(int*); static void foo(long*);
void bar(A *a) {
foo(a); }
};
}
namespace DerivedToBase {
struct A { };
struct B : A { };
struct C : B { };
int &f0(const A&);
float &f0(B);
void g() {
float &fr = f0(C());
}
}
namespace PR6483 {
struct X0 {
operator const unsigned int & () const;
};
struct X1 {
operator unsigned int & () const;
};
void f0(const bool &);
void f1(bool &);
void g(X0 x0, X1 x1) {
f0(x0);
f1(x0); f0(x1);
f1(x1); }
}
namespace PR6078 {
struct A {
A(short); A(long); };
struct S {
typedef void ft(A);
operator ft*();
};
void f() {
S()(0); }
}
namespace PR6177 {
struct String { String(char const*); };
void f(bool const volatile&);
int &f(String);
void g() { int &r = f(""); }
}
namespace PR7095 {
struct X { };
struct Y {
operator const X*();
private:
operator X*();
};
void f(const X *);
void g(Y y) { f(y); }
}
namespace PR7224 {
class A {};
class B : public A {};
int &foo(A *const d);
float &foo(const A *const d);
void bar()
{
B *const d = 0;
B const *const d2 = 0;
int &ir = foo(d);
float &fr = foo(d2);
}
}
namespace NontrivialSubsequence {
struct X0;
class A {
operator X0 *();
public:
operator const X0 *();
};
A a;
void foo( void const * );
void g() {
foo(a);
}
}
namespace rdar8499524 {
struct W {};
struct S {
S(...);
};
void g(const S&);
void f() {
g(W());
}
}
namespace rdar9173984 {
template <typename T, unsigned long N> int &f(const T (&)[N]);
template <typename T> float &f(const T *);
void test() {
int arr[2] = {0, 0};
int *arrp = arr;
int &ir = f(arr);
float &fr = f(arrp);
}
}
namespace PR9507 {
void f(int * const&); void f(int const(&)[1]);
int main() {
int n[1];
f(n); }
}
namespace rdar9803316 {
void foo(float);
int &foo(int);
void bar() {
int &ir = (&foo)(0);
}
}
namespace IncompleteArg {
template<typename T> struct S {
friend int f(const S&);
};
extern S<int> s;
int k = f(s);
template<typename T> struct Op {
friend bool operator==(const Op &, const Op &);
};
extern Op<char> op;
bool b = op == op;
template<typename T> struct U {
T t;
};
struct Consumer {
template<typename T>
int operator()(const U<T> &);
};
template<typename T> U<T> &make();
Consumer c;
int n = sizeof(c(make<int()>()));
}
namespace PR12142 {
void fun(int (*x)[10]); void g() { fun((const int(*)[10])0); } }
namespace PR12931 {
void f(const int &, ...);
void f(const volatile int &, int);
void g() { f(0, 0); }
}
void test5() {
struct {
typedef void F1(int);
typedef void F2(double);
operator F1*(); operator F2*(); } callable;
callable(); }
namespace PR20218 {
void f(void (*const &)()); void f(void (&&)()) = delete; #if __cplusplus <= 199711L
#endif
void g(void (&&)()) = delete; #if __cplusplus <= 199711L
#endif
void g(void (*const &)());
void x();
typedef void (&fr)();
struct Y { operator fr(); } y;
void h() {
f(x); g(x); f(y); g(y); }
}
namespace StringLiteralToCharAmbiguity {
void f(char *, int);
void f(const char *, unsigned);
void g() { f("foo", 0); }
#if __cplusplus <= 199711L
#endif
}
namespace ProduceNotesAfterSFINAEFailure {
struct A {
template<typename T, typename U = typename T::x> A(T); };
void f(void*, A); void g() { f(1, 2); } }
namespace PR19808 {
struct B {
int i;
void bar();
};
struct D : public B{};
void f(bool);
void f(int D::*);
void f(void (D::*)());
void Usage() {
int B::*pmem;
void (B::*pmf)();
f(pmem);
f(pmf);
}
}