blob: 5e20a801872be6df7e22707ee24f6aefbd2fea39 [file] [log] [blame]
SKIP: FAILED
#include <metal_stdlib>
using namespace metal;
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 S {
tint_array<int4, 4> a;
};
thread int counter = 0;
int foo() {
counter = (counter + 1);
return counter;
}
int bar() {
counter = (counter + 2);
return counter;
}
void tint_symbol() {
S x = S{};
thread S* const p = x;
thread int4* const v = p.a[foo()];
int const v_1 = bar();
v[v_1] = (v[v_1] + 5);
}
program_source:19:12: error: program scope variable must reside in constant address space
thread int counter = 0;
^
program_source:30:19: error: no viable conversion from 'S' to 'S *const'
thread S* const p = x;
^ ~
program_source:31:27: error: member reference type 'S *const' is a pointer; did you mean to use '->'?
thread int4* const v = p.a[foo()];
~^
->
program_source:31:22: error: cannot initialize a variable of type 'int4 *const' with an lvalue of type 'int __attribute__((ext_vector_type(4)))' (vector of 4 'int' values)
thread int4* const v = p.a[foo()];
^ ~~~~~~~~~~