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: unassignedclangb...@nondot.org
          Reporter: ldio...@apple.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to