<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - if (!@available) doesn't work and has confusing diagnostic"
   href="https://bugs.llvm.org/show_bug.cgi?id=33814">33814</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>if (!@available) doesn't work and has confusing diagnostic
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We're using @available some in chrome, and I'm getting feedback that people are
confused about writing `if (!@available`. That's kind of understandable, here's
the current experience:

thakis@thakis:~/src/chrome/src$ cat test.mm
void f() {
  if (!@available(macos 10.10, *)) {
    return;
  }
  // 10.10-only code here
}
thakis@thakis:~/src/chrome/src$
third_party/llvm-build/Release+Asserts/bin/clang -c test.mm -target
x86_64-apple-darwin
test.mm:2:8: warning: @available does not guard availability here; use if
(@available) instead [-Wunsupported-availability-guard]
  if (!@available(macos 10.10, *)) {
       ^

It'd be cool if this pattern just worked somehow (full CFG-awareness likely
isn't needed).

Even just `if (!@available()) {} else {}` so that the else block gets the
available OS would be nice.

If that isn't feasible, making the error message more explicit might help.

(But maybe just having the docs is good enough too, most people who are
confused about this haven't read the docs we added on Friday yet.)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>