[llvm-bugs] [Bug 50310] New: Duplicate -Wunguarded-availability warnings on nested classes when if(@available) is present

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 11 23:04:43 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50310

            Bug ID: 50310
           Summary: Duplicate -Wunguarded-availability warnings on nested
                    classes when if(@available) is present
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: logan.r.smith0 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The presence of an if(@available) check in a function body can cause duplicate
-Wunguarded-availability warnings to be produced on members of nested classes
in that same function body:

// clang -cc1 -xobjective-c++ -triple x86_64-apple-macosx10.9
-Wunguarded-availability -fblocks -fsyntax-only

typedef int __attribute__((availability(macos, introduced = 10.12))) new_int;
void foo() {
    struct local {
        new_int x; // two -Wunguarded-availability warnings produced on this
line
    };

    if (@available(macos 10.12, *)) {}
}

Removing the if(@available) check below the struct causes only one warning to
be produced, as expected.

-- 
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/20210512/125af44c/attachment.html>


More information about the llvm-bugs mailing list