p3.cpp revision 7abfbdbc97ad8e7f340789f751df1e32b10118b4
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 function}}
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