blob: af589aabd95512fbe6bac2ae15547633860830ff [file]
SKIP: FAILED
#include <metal_stdlib>
using namespace metal;
struct str {
int 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];
};
str func(thread str* const pointer) {
return pointer;
}
kernel void tint_symbol() {
tint_array<str, 4> F = {};
str const r = func(F[2]);
}
program_source:20:10: error: no viable conversion from returned value of type 'str *const' to function return type 'str'
return pointer;
^~~~~~~
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const str &' for 1st argument; dereference the argument with *
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const str &' for 1st argument; dereference the argument with *
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const str &' for 1st argument; dereference the argument with *
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const device str &' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const threadgroup str &' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const constant str &' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const device str &' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const threadgroup str &' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const constant str &' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'str *const' to 'const constant str &' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'str *const' to 'str &&' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'str *const' to 'device str &&' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'str *const' to 'threadgroup str &&' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'str *const' to 'str &&' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'str *const' to 'device str &&' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'str *const' to 'threadgroup str &&' for 1st argument
struct str {
^
program_source:3:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'str *const' to 'str &&' for 1st argument
struct str {
^
program_source:24:17: error: no matching function for call to 'func'
str const r = func(F[2]);
^~~~
program_source:19:5: note: candidate function not viable: no known conversion from 'str' to 'str *const' for 1st argument; take the address of the argument with &
str func(thread str* const pointer) {
^