xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/qualified-id.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // PR5061
4*f4a2713aSLionel Sambuc namespace a {
5*f4a2713aSLionel Sambuc   template <typename T> class C {};
6*f4a2713aSLionel Sambuc }
7*f4a2713aSLionel Sambuc namespace b {
f0(a::C<T> & a0)8*f4a2713aSLionel Sambuc   template<typename T> void f0(a::C<T> &a0) { }
9*f4a2713aSLionel Sambuc }
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc namespace test1 {
13*f4a2713aSLionel Sambuc   int a = 0;
14*f4a2713aSLionel Sambuc   template <class T> class Base { };
15*f4a2713aSLionel Sambuc   template <class T> class Derived : public Base<T> {
foo()16*f4a2713aSLionel Sambuc     int foo() {
17*f4a2713aSLionel Sambuc       return test1::a;
18*f4a2713aSLionel Sambuc     }
19*f4a2713aSLionel Sambuc   };
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc namespace test2 {
23*f4a2713aSLionel Sambuc   class Impl {
24*f4a2713aSLionel Sambuc   public:
25*f4a2713aSLionel Sambuc     int foo();
26*f4a2713aSLionel Sambuc   };
27*f4a2713aSLionel Sambuc   template <class T> class Magic : public Impl {
foo()28*f4a2713aSLionel Sambuc     int foo() {
29*f4a2713aSLionel Sambuc       return Impl::foo();
30*f4a2713aSLionel Sambuc     }
31*f4a2713aSLionel Sambuc   };
32*f4a2713aSLionel Sambuc }
33*f4a2713aSLionel Sambuc 
34*f4a2713aSLionel Sambuc namespace PR6063 {
35*f4a2713aSLionel Sambuc   template <typename T> void f(T, T);
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc   namespace detail
38*f4a2713aSLionel Sambuc   {
39*f4a2713aSLionel Sambuc     using PR6063::f;
40*f4a2713aSLionel Sambuc   }
41*f4a2713aSLionel Sambuc 
42*f4a2713aSLionel Sambuc   template <typename T>
g(T a,T b)43*f4a2713aSLionel Sambuc   void g(T a, T b)
44*f4a2713aSLionel Sambuc   {
45*f4a2713aSLionel Sambuc     detail::f(a, b);
46*f4a2713aSLionel Sambuc   }
47*f4a2713aSLionel Sambuc }
48*f4a2713aSLionel Sambuc 
49*f4a2713aSLionel Sambuc namespace PR12291 {
50*f4a2713aSLionel Sambuc   template <typename T>
51*f4a2713aSLionel Sambuc   class Outer2 {
52*f4a2713aSLionel Sambuc     template <typename V>
53*f4a2713aSLionel Sambuc     template <typename W>
54*f4a2713aSLionel Sambuc     class Outer2<V>::Inner; // expected-error{{nested name specifier 'Outer2<V>::' for declaration does not refer into a class, class template or class template partial specialization}}
55*f4a2713aSLionel Sambuc   };
56*f4a2713aSLionel Sambuc }
57