// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <sycl/detail/core.hpp>

using namespace sycl;

struct F1 {};
struct F2 {};
struct F : F1, F2 {
  char x;
};

bool test0() {
  F S;
  S.x = 0;
  F S0;
  S0.x = 1;
  {
    buffer<F, 1> Buf(&S0, range<1>(1));
    queue myQueue;
    myQueue.submit([&](handler &cgh) {
      auto B = Buf.get_access<access::mode::write>(cgh);
      cgh.single_task<class NonStandard>([=] { B[0] = S; });
    });
  }
  bool Passed = (S.x == S0.x);

  if (!Passed) {
    std::cout << "test0 failed" << std::endl;
  }
  return Passed;
}

int main() {

  bool Pass = test0();

  std::cout << "Test " << (Pass ? "passed" : "FAILED") << std::endl;
  return Pass ? 0 : 1;
}
