[llvm-bugs] [Bug 40991] New: Availability attribute incorrectly triggers when function is called in a default argument of an unavailable function
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Mar 7 07:01:30 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40991
Bug ID: 40991
Summary: Availability attribute incorrectly triggers when
function is called in a default argument of an
unavailable function
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: ldionne at apple.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
When defining a function `f` as unavailable, uses of other unavailable
functions within the body of `f` are not flagged (because the top-level
function is unavailable). However, using an unavailable function as a default
argument triggers an error:
$ cat <<EOF | clang++ -xc++ -
__attribute__((unavailable)) int bar() { return 0; }
__attribute__((unavailable)) void foo(int = bar()) { }
int main() { }
EOF
Output:
<stdin>:2:45: error: call to unavailable function 'bar':
__attribute__((unavailable)) void foo(int = bar()) { }
^~~
<stdin>:1:34: note: candidate function has been explicitly made unavailable
__attribute__((unavailable)) int bar() { return 0; }
^
I think the call to bar() should not be flagged since foo() is marked
unavailable.
--
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/20190307/63e2b01c/attachment.html>
More information about the llvm-bugs
mailing list