<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Precompiled headers don't work with `#pragma once`"
   href="https://llvm.org/bugs/show_bug.cgi?id=24387">24387</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Precompiled headers don't work with `#pragma once`
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hitchmanr@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>#pragma once information isn't stored in precompiled headers. This makes PCH
useless for projects that use #pragma once as the only form of header guard.

Test case:

a.h:

    #pragma once
    static int x = 3;

a.c:

    #include "a.h"
    int main(void) { return 0; }

then:

    $ clang a.c -o a
    $ clang a.h -o a.h.pch
    a.h:1:9: warning: #pragma once in main file
    #pragma once
            ^
    1 warning generated.
    $ clang -include-pch a.h.pch a.c -o a
    In file included from a.c:1:
    ./a.h:3:12: error: redefinition of 'x'
    static int x = 3;
               ^
    ./a.h:3:12: note: previous definition is here
    static int x = 3;
               ^
    1 error generated.</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>