2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-08-30 03:37:28 +08:00
|
|
|
|
2009-12-03 08:58:24 +08:00
|
|
|
namespace test0 {
|
|
|
|
namespace N { }
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct A {
|
|
|
|
void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct B : A<T> {
|
|
|
|
using A<T>::f;
|
|
|
|
|
|
|
|
void g() {
|
|
|
|
using namespace N;
|
|
|
|
f();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template struct B<int>;
|
|
|
|
}
|
2009-08-30 03:37:28 +08:00
|
|
|
|
2009-12-03 08:58:24 +08:00
|
|
|
namespace test1 {
|
|
|
|
template <class Derived> struct Visitor1 {
|
|
|
|
void Visit(struct Object1*);
|
|
|
|
};
|
|
|
|
template <class Derived> struct Visitor2 {
|
|
|
|
void Visit(struct Object2*); // expected-note {{candidate function}}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class Derived> struct JoinVisitor
|
|
|
|
: Visitor1<Derived>, Visitor2<Derived> {
|
|
|
|
typedef Visitor1<Derived> Base1;
|
|
|
|
typedef Visitor2<Derived> Base2;
|
|
|
|
|
|
|
|
void Visit(struct Object1*); // expected-note {{candidate function}}
|
|
|
|
using Base2::Visit;
|
|
|
|
};
|
|
|
|
|
2010-04-10 03:03:51 +08:00
|
|
|
class Knot : public JoinVisitor<Knot> {
|
2009-12-03 08:58:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void test() {
|
|
|
|
Knot().Visit((struct Object1*) 0);
|
|
|
|
Knot().Visit((struct Object2*) 0);
|
|
|
|
Knot().Visit((struct Object3*) 0); // expected-error {{no matching member function for call}}
|
|
|
|
}
|
|
|
|
}
|
2009-12-23 06:26:37 +08:00
|
|
|
|
|
|
|
// PR5847
|
|
|
|
namespace test2 {
|
|
|
|
namespace ns {
|
|
|
|
void foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T> void bar(T* ptr) {
|
|
|
|
using ns::foo;
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
template void bar(char *);
|
|
|
|
}
|