File: temp_class_spec_neg.cpp

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-16
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,496,368 kB
  • sloc: cpp: 5,593,980; ansic: 986,873; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,547; xml: 953; cs: 573; fortran: 567
file content (47 lines) | stat: -rw-r--r-- 1,669 bytes parent folder | download | duplicates (27)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
template<typename T> struct vector;

// C++ [temp.class.spec]p6:
namespace N {
  namespace M {
    template<typename T> struct A;
  }
}

template<typename T>
struct N::M::A<T*> { };

// C++ [temp.class.spec]p9
//   bullet 1, as amended by DR1315
template <int I, int J> struct A {}; 
template <int I> struct A<I+5, I*2> {}; // expected-error{{cannot be deduced}} expected-note {{'I'}}
template <int I, int J> struct B {}; 
template <int I> struct B<I, I> {}; //OK 

//   bullet 2
template <class T, T t> struct C {};  // expected-note{{declared here}}
template <class T> struct C<T, 1>; // expected-error{{specializes}}
template <class T, T* t> struct C<T*, t>; // okay

template< int X, int (*array_ptr)[X] > class A2 {}; // expected-note{{here}}
int array[5]; 
template< int X > class A2<X, &array> { }; // expected-error{{specializes}}

template<typename T, int N, template<typename X> class TT>
struct Test0;

//   bullet 3
template<typename T, int N, template<typename X> class TT>
struct Test0<T, N, TT>; // expected-error{{does not specialize}}

// C++ [temp.class.spec]p10
template<typename T = int, // expected-error{{default template argument}}
         int N = 17, // expected-error{{default template argument}}
         template<typename X> class TT = ::vector> // expected-error{{default template argument}}
  struct Test0<T*, N, TT> { };

template<typename T> struct Test1;
template<typename T, typename U>  // expected-note{{non-deducible}}
  struct Test1<T*> { }; // expected-error{{never be used}}