<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - ICE when assigning a function to a pointer."
href="https://bugs.llvm.org/show_bug.cgi?id=49315">49315</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ICE when assigning a function to a pointer.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>OpenCL
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>anastasia.stulova@arm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>anastasia.stulova@arm.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>When the extension for the function pointers is used
#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable
void foo();
void bar(){
void (*f)() = foo;
}
frontend fails to compile it failing in the incorrect address space conversion
check.
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e03183c1a42f..8aece0b63037 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -15823,6 +15823,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType
ConvTy,
isInvalid = true;
+ // FIXME: On function types we should not be taking a pointee.
Qualifiers lhq = SrcType->getPointeeType().getQualifiers();
Qualifiers rhq = DstType->getPointeeType().getQualifiers();
+ // FIXME: The right check should take the address space compatibility into
account.
if (lhq.getAddressSpace() != rhq.getAddressSpace()) {
This issue is not triggered in C++ for OpenCL mode that seems to follow
different conversion path.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>