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];
};


thread tint_array<tint_array<int, 3>, 2> zero = {};
thread tint_array<tint_array<int, 3>, 2> init = tint_array<tint_array<int, 3>, 2>{tint_array<int, 3>{1, 2, 3}, tint_array<int, 3>{4, 5, 6}};
kernel void tint_symbol() {
  tint_array<tint_array<int, 3>, 2> v0 = zero;
  tint_array<tint_array<int, 3>, 2> v1 = init;
}
program_source:16:42: error: program scope variable must reside in constant address space
thread tint_array<tint_array<int, 3>, 2> zero = {};
                                         ^
program_source:17:42: error: program scope variable must reside in constant address space
thread tint_array<tint_array<int, 3>, 2> init = tint_array<tint_array<int, 3>, 2>{tint_array<int, 3>{1, 2, 3}, tint_array<int, 3>{4, 5, 6}};
                                         ^
program_source:19:37: warning: unused variable 'v0' [-Wunused-variable]
  tint_array<tint_array<int, 3>, 2> v0 = zero;
                                    ^
program_source:20:37: warning: unused variable 'v1' [-Wunused-variable]
  tint_array<tint_array<int, 3>, 2> v1 = init;
                                    ^

