aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/ext-vector-type.cpp
blob: d6c02bb629ff10189dc50db39de06b348ee2b2cc (plain)
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-cc -fsyntax-only -verify %s
template<typename T, unsigned Length> 
struct make1 { 
  typedef T __attribute__((ext_vector_type(Length))) type; 
};

int test_make1() {
  make1<int, 5>::type x;
  x.x = 4;
}

template<typename T, unsigned Length> 
struct make2 { 
  typedef T __attribute__((ext_vector_type(Length))) type; // expected-error{{zero vector size}}
};

int test_make2() {
  make2<int, 0> x; // expected-note{{in instantiation of}} 
}

template<typename T, unsigned Length> 
struct make3 { 
  typedef T __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type 'struct s'}}
};

struct s {};

int test_make3() {
  make3<s, 3>x; // expected-note{{in instantiation of}} 
}

template<typename T, T Length> 
struct make4 { 
  typedef T __attribute__((ext_vector_type(Length))) type; 
};

int test_make4() {
  make4<int, 4>::type x;
  x.w = 7;
}

typedef int* int_ptr;
template<unsigned Length>
struct make5 {
  typedef int_ptr __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type}}             
};