1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Test template instantiation for C99-specific features.
5 // ---------------------------------------------------------------------
6 // Designated initializers
7 // ---------------------------------------------------------------------
8 template<typename T, typename XType, typename YType>
10 void f(XType x, YType y) {
12 .y = y, // expected-error{{does not refer}}
13 .x = x // expected-error{{does not refer}}
22 template struct DesigInit0<Point2D, int, double>;
28 template struct DesigInit0<Point3D, int, double>;
31 unsigned char red, green, blue;
39 template struct DesigInit0<ColorPoint3D, int, double>;
40 template struct DesigInit0<Color, int, double>; // expected-note{{instantiation}}
42 template<typename T, int Subscript1, int Subscript2,
43 typename Val1, typename Val2>
44 struct DesigArrayInit0 {
45 void f(Val1 val1, Val2 val2) {
48 [Subscript2] = val2 // expected-error{{exceeds array bounds}}
51 int array2[10] = { [5] = 3 };
55 template struct DesigArrayInit0<int[8], 5, 3, float, int>;
56 template struct DesigArrayInit0<int[8], 5, 13, float, int>; // expected-note{{instantiation}}
58 template<typename T, int Subscript1, int Subscript2,
60 struct DesigArrayRangeInit0 {
63 [Subscript1...Subscript2] = val1 // expected-error{{exceeds}}
68 template struct DesigArrayRangeInit0<int[8], 3, 5, float>;
69 template struct DesigArrayRangeInit0<int[8], 5, 13, float>; // expected-note{{instantiation}}
71 // ---------------------------------------------------------------------
73 // ---------------------------------------------------------------------
74 template<typename T, typename Arg1, typename Arg2>
75 struct CompoundLiteral0 {
76 T f(Arg1 a1, Arg2 a2) {
81 template struct CompoundLiteral0<Point2D, int, float>;