[llvm-bugs] [Bug 49310] New: [C++4OpenCL] Inconsistent diagnostics for taking function address
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 22 04:46:37 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49310
Bug ID: 49310
Summary: [C++4OpenCL] Inconsistent diagnostics for taking
function address
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: OpenCL
Assignee: unassignedclangbugs at nondot.org
Reporter: anastasia.stulova at arm.com
CC: anastasia.stulova at arm.com, llvm-bugs at lists.llvm.org
An inconsistent diagnostic is given when function addresses are taken i.e.
template functions are not diagnosed while normal functions are.
template<class T>
void f1(){}
void f2(){}
void bar(){
f1<int>;
f2;//error: taking address of function is not allowed
}
It is not clear though why the diagnostic was added since OpenCL C never
restricted taking addresses of functions. Perhaps it was considered useless
since function pointers can't be used. However, taking an address doesn't imply
that the function will necessarily be called even if it is the most common use
case. In addition to that, the diagnostic is handled in Parser and not Sema
where it conceptually belongs. Potentially we need to see if we can just remove
the diagnostic.
--
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/20210222/206da1ad/attachment.html>
More information about the llvm-bugs
mailing list