[llvm-bugs] [Bug 42390] New: Cannot initialize parameter of different address space if class / function is templated
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 25 13:27:02 PDT 2019
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: unassignedclangbugs at nondot.org
Reporter: drohr at jwdt.org
CC: anastasia.stulova at arm.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190625/d70d0c92/attachment-0001.html>
More information about the llvm-bugs
mailing list