<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 - Rejects valid with _Atomic void"
   href="https://bugs.llvm.org/show_bug.cgi?id=37237">37237</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Rejects valid with _Atomic void
          </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>Windows NT
          </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>aaron@aaronballman.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>C does not disallow void types from having the _Atomic qualifier.

C17 6.7.3p4:
The type modified by the _Atomic qualifier shall not be an array type or a
function type.

A void type is neither an array type nor a function type, thus void is allowed
to be qualified. This turns out to be useful for people who want to write
generic C code like: void f(_Atomic void *ptr);

We currently diagnose this because the C standard is not clear whether the
_Atomic qualifier requires a complete type, so this is currently a purposeful
diagnosis. However, when this topic came up in the context of WG14 N2209
(atomic pointers in expressions) the paper noted that Clang was the only
implementation that seems to diagnose the construct. Further, it seems to be a
generally useful construct outside of void, such as:

// Header file
struct S;
void f(_Atomic struct S *ptr);

// Implementation file
struct S { int a, b; };
void f(_Atomic struct S *ptr) {
  // Stuff
}

Given that the standard does not explicitly state that the qualified type must
be complete, I don't think we should require it. This keeps _Atomic the same as
const and volatile in that regard and aligns with how I interpret the feeling
in the room at WG14 in Brno.</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>