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