1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// A type-parameter defines its identifier to be a type-name (if
4// declared with class or typename) or template-name (if declared with
5// template) in the scope of the template declaration.
6template<typename T> struct X0 {
7  T* value;
8};
9
10template<template<class T> class Y> struct X1 {
11  Y<int> value;
12};
13
14// [Note: because of the name lookup rules, a template-parameter that
15// could be interpreted as either a non-type template-parameter or a
16// type-parameter (because its identifier is the name of an already
17// existing class) is taken as a type-parameter. For example,
18class T { /* ... */ };  // expected-note{{candidate constructor (the implicit copy constructor) not viable}}
19int i;
20
21template<class T, T i> struct X2 {
22  void f(T t)
23  {
24    T t1 = i; //template-parameters T and i
25    ::T t2 = ::i; // global namespace members T and i  \
26    // expected-error{{no viable conversion}}
27  }
28};
29
30namespace PR6831 {
31  namespace NA { struct S; }
32  namespace NB { struct S; }
33
34  using namespace NA;
35  using namespace NB;
36
37  template <typename S> void foo();
38  template <int S> void bar();
39  template <template<typename> class S> void baz();
40}
41