instantiate-clang.cpp revision 3573b2c84372d9484296fa658f5276f6c09acb92
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// Test template instantiation for Clang-specific features.
4
5// ---------------------------------------------------------------------
6// Vector types
7// ---------------------------------------------------------------------
8typedef __attribute__(( ext_vector_type(2) )) double double2;
9typedef __attribute__(( ext_vector_type(4) )) double double4;
10
11template<typename T>
12struct ExtVectorAccess0 {
13  void f(T v1, double4 v2) {
14    v1.xy = v2.yx;
15  }
16};
17
18template struct ExtVectorAccess0<double2>;
19template struct ExtVectorAccess0<double4>;
20
21typedef __attribute__(( ext_vector_type(2) )) double double2;
22
23template<typename T, typename U, int N, int M>
24struct ShuffleVector0 {
25  void f(T t, U u, double2 a, double2 b) {
26    (void)__builtin_shufflevector(t, u, N, M); // expected-error{{index}}
27    (void)__builtin_shufflevector(a, b, N, M);
28    (void)__builtin_shufflevector(a, b, 2, 1);
29  }
30};
31
32template struct ShuffleVector0<double2, double2, 2, 1>;
33template struct ShuffleVector0<double2, double2, 4, 3>; // expected-note{{instantiation}}
34
35
36