brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · c70b1d3 Raw
52 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s 2// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -DCPP113// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s -DCPP174 5// There is no semantic difference between class and typename in a6// template-parameter. typename followed by an unqualified-id names a7// template type parameter.8template<class T> struct X;9template<typename T> struct X;10 11// typename followed by a qualified-id denotes the type in a non-type12// parameter-declaration.13template<typename T, typename T::type Value> struct Y0;14template<typename T, typename X<T>::type Value> struct Y1;15template<typename T typename U> struct Y2; // expected-error{{expected ',' or '>'}}16template<typename T U> struct Y3; // expected-error{{expected a qualified name after 'typename'}} expected-error{{expected ',' or '>'}}17template<typedef T typename U> struct Y4; // expected-error{{expected template parameter}} expected-note {{did you mean to use 'typename'?}} expected-error{{expected ',' or '>'}}18 19// A storage class shall not be specified in a template-parameter declaration.20template<static int Value> struct Z; //expected-error{{invalid declaration specifier}}21template<typedef int Value> struct Z0; //expected-error{{invalid declaration specifier}}22template<extern inline int Value> struct Z1; //expected-error2{{invalid declaration specifier}}23template<virtual int Value> struct Z2; //expected-error{{invalid declaration specifier}}24template<explicit int Value> struct Z3; //expected-error{{invalid declaration specifier}}25template<inline int Value> struct Z4; //expected-error{{invalid declaration specifier}}26template<extern int> struct Z5; //expected-error{{invalid declaration specifier}}27template<static int> struct Z6;  //expected-error{{invalid declaration specifier}}28template<explicit int Value> struct Z7; //expected-error{{invalid declaration specifier}}29template<mutable int> struct Z8; //expected-error{{invalid declaration specifier}}30 31template<const int> struct Z9; // OK32template<volatile int> struct Z10; // OK33 34 35 36#ifdef CPP1137template<thread_local int> struct Z11; //expected-error{{invalid declaration specifier}}38template<constexpr int> struct Z12; //expected-error{{invalid declaration specifier}}39 40#endif41 42#ifdef CPP1743template<auto> struct Z13; // OK44#endif45 46// Make sure that we properly disambiguate non-type template parameters that47// start with 'class'.48class X1 { };49template<class X1 *xptr> struct X2 { };50 51// FIXME: add the example from p252