llvm-project/clang/test/SemaCXX/using-decl-1.cpp

63 lines
1004 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
extern "C" { void f(bool); }
namespace std {
using ::f;
inline void f() { return f(true); }
}
namespace M {
void f(float);
}
namespace N {
using M::f;
void f(int) { } // expected-note{{previous}}
void f(int) { } // expected-error{{redefinition}}
}
namespace N {
void f(double);
void f(long);
}
struct X0 {
void operator()(int);
void operator()(long);
};
struct X1 : X0 {
// FIXME: give this operator() a 'float' parameter to test overloading
// behavior. It currently fails.
void operator()();
using X0::operator();
void test() {
(*this)(1);
}
};
struct A { void f(); };
struct B : A { };
class C : B { using B::f; };
// PR5751: Resolve overloaded functions through using decls.
namespace O {
void f(int i);
void f(double d);
}
namespace P {
void f();
void g(void (*ptr)(int));
using O::f;
void test() {
f();
f(1);
void (*f_ptr1)(double) = f;
void (*f_ptr2)() = f;
g(f);
}
}