https://bugs.llvm.org/show_bug.cgi?id=49315
Bug ID: 49315
Summary: ICE when assigning a function to a pointer.
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: OpenCL
Assignee: unassignedclangb...@nondot.org
Reporter: anastasia.stul...@arm.com
CC: anastasia.stul...@arm.com, llvm-bugs@lists.llvm.org
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.
--
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