https://bugs.llvm.org/show_bug.cgi?id=42390
Bug ID: 42390
Summary: Cannot initialize parameter of different address space
if class / function is templated
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: OpenCL
Assignee: unassignedclangb...@nondot.org
Reporter: dr...@jwdt.org
CC: anastasia.stul...@arm.com, llvm-bugs@lists.llvm.org
This might be related to bugs 42033 or 42385.
The following code (compiled with -cl-std=c++)
template <class T>
struct x {
x<T>& operator=(const x<T>& xx) {
y = xx.y;
return *this;
}
int y;
};
template <class T>
struct x2 {
void foo(x<T>* xx) {
m[0] = *xx;
}
x<T> m[2];
};
void bar(__global x<int>* xx, __global x2<int>* bar)
{
bar->foo(xx);
}
fails with
test.cl:21:12: error: cannot initialize a parameter of type 'x<int> *' with an
lvalue of type '__global x<int> *'
bar->foo(xx);
^~
test.cl:13:18: note: passing argument to parameter 'xx' here
void foo(x<T>* xx) {
^
test.cl:5:12: error: binding value of type '__generic x<...>' to reference to
type 'x<...>' drops <<ERROR>> qualifiers
return *this;
^~~~~
test.cl:14:10: note: in instantiation of member function 'x<int>::operator='
requested here
m[0] = *xx;
^
test.cl:21:8: note: in instantiation of member function 'x2<int>::foo'
requested here
bar->foo(xx);
If I remove all the templates (which actually don't do anything), it compiles
correctly.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs