Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / temp / temp.param / p3.cpp
blobf709630504cdb529420c0d5569d9f24911dca6ba
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
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;
12 template<template<class T> class Y> struct X1 {
13 Y<int> value;
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
25 int i;
27 template<class T, T i> struct X2 {
28 void f(T t)
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}}
36 namespace PR6831 {
37 namespace NA { struct S; }
38 namespace NB { struct S; }
40 using namespace NA;
41 using namespace NB;
43 template <typename S> void foo();
44 template <int S> void bar();
45 template <template<typename> class S> void baz();