brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · f709630 Raw
47 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5// A type-parameter defines its identifier to be a type-name (if6// declared with class or typename) or template-name (if declared with7// template) in the scope of the template declaration.8template<typename T> struct X0 {9  T* value;10};11 12template<template<class T> class Y> struct X1 {13  Y<int> value;14};15 16// [Note: because of the name lookup rules, a template-parameter that17// could be interpreted as either a non-type template-parameter or a18// type-parameter (because its identifier is the name of an already19// existing class) is taken as a type-parameter. For example,20class T { /* ... */ };  // expected-note{{candidate constructor (the implicit copy constructor) not viable}}21#if __cplusplus >= 201103L // C++11 or later22// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}}23#endif24 25int i; 26 27template<class T, T i> struct X2 {28  void f(T t) 29  { 30    T t1 = i; // template-parameters T and i31    ::T t2 = ::i; // global namespace members T and i  \32    // expected-error{{no viable conversion}}33  } 34};35 36namespace 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}47