blob: 5ceced062654c9f52a45373cd701f145a7eb9b02 [file] [log] [blame]
SKIP: FAILED
#include <metal_stdlib>
using namespace metal;
struct S1 {
int a;
int b;
int c;
int d;
};
struct S2 {
int e;
S1 f;
};
struct S3 {
int g;
S1 h;
S2 i;
};
template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
const device T& operator[](size_t i) const device { return elements[i]; }
thread T& operator[](size_t i) thread { return elements[i]; }
const thread T& operator[](size_t i) const thread { return elements[i]; }
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
T elements[N];
};
struct T {
tint_array<int, 2> a;
};
kernel void tint_symbol() {
int const x = 42;
S1 const empty = S1{};
S1 const nonempty = S1{.a=1, .b=2, .c=3, .d=4};
S1 const nonempty_with_expr = {.a=1, .b=x, .c=(x + 1), .d=nonempty.d};
S3 const nested_empty = S3{};
S3 const nested_nonempty = S3{.g=1, .h=S1{.a=2, .b=3, .c=4, .d=5}, .i=S2{.e=6, .f=S1{.a=7, .b=8, .c=9, .d=10}}};
S1 const v = {.a=2, .b=x, .c=(x + 1), .d=nested_nonempty.i.f.d};
S3 const nested_nonempty_with_expr = {.g=1, .h=v, .i={.e=6, .f=nonempty}};
int const subexpr_empty = 0;
int const subexpr_nonempty = 2;
int const subexpr_nonempty_with_expr = {.a=1, .b=x, .c=(x + 1), .d=nonempty.d}.c;
S1 const subexpr_nested_empty = S1{};
S1 const subexpr_nested_nonempty = S1{.a=2, .b=3, .c=4, .d=5};
S1 const subexpr_nested_nonempty_with_expr = {.e=1, .f={.a=2, .b=x, .c=(x + 1), .d=nested_nonempty.i.f.d}}.f;
tint_array<T, 2> const aosoa_empty = tint_array<T, 2>{};
tint_array<T, 2> const aosoa_nonempty = tint_array<T, 2>{T{.a=tint_array<int, 2>{1, 2}}, T{.a=tint_array<int, 2>{3, 4}}};
tint_array<T, 2> const aosoa_nonempty_with_expr = tint_array<T, 2>{{.a=tint_array<int, 2>{1, (aosoa_nonempty[0].a[0] + 1)}}, aosoa_nonempty[1]};
}
program_source:45:13: error: excess elements in scalar initializer
int const subexpr_nonempty_with_expr = {.a=1, .b=x, .c=(x + 1), .d=nonempty.d}.c;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:45:81: error: expected ';' at end of declaration
int const subexpr_nonempty_with_expr = {.a=1, .b=x, .c=(x + 1), .d=nonempty.d}.c;
^
;
program_source:48:50: error: field designator 'e' does not refer to any field in type 'const S1'
S1 const subexpr_nested_nonempty_with_expr = {.e=1, .f={.a=2, .b=x, .c=(x + 1), .d=nested_nonempty.i.f.d}}.f;
^
program_source:48:56: error: field designator 'f' does not refer to any field in type 'const S1'
S1 const subexpr_nested_nonempty_with_expr = {.e=1, .f={.a=2, .b=x, .c=(x + 1), .d=nested_nonempty.i.f.d}}.f;
^
program_source:48:109: error: expected ';' at end of declaration
S1 const subexpr_nested_nonempty_with_expr = {.e=1, .f={.a=2, .b=x, .c=(x + 1), .d=nested_nonempty.i.f.d}}.f;
^
;
program_source:51:71: error: field designator cannot initialize a non-class type 'T[2]'
tint_array<T, 2> const aosoa_nonempty_with_expr = tint_array<T, 2>{{.a=tint_array<int, 2>{1, (aosoa_nonempty[0].a[0] + 1)}}, aosoa_nonempty[1]};
^