<html>
    <head>
      <base href="http://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 --- - Including llvm/Support/SourceMgr.h kills PCH"
   href="http://llvm.org/bugs/show_bug.cgi?id=22405">22405</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Including llvm/Support/SourceMgr.h kills PCH
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Support Libraries
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>tim.besard@elis.ugent.be
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13774" name="attach_13774" title="Full compilation and error log (generating PCH + using it) using clang 3.5, compiling against LLVM 3.6 headers.">attachment 13774</a> <a href="attachment.cgi?id=13774&action=edit" title="Full compilation and error log (generating PCH + using it) using clang 3.5, compiling against LLVM 3.6 headers.">[details]</a></span>
Full compilation and error log (generating PCH + using it) using clang 3.5,
compiling against LLVM 3.6 headers.

If my to-be-precompiled header file (directly or indirectly) includes
"llvm/Support/SourceMgr.h", including the PCH when compiling other objects
generates an error:
llvm/Support/SourceMgr.h:48:10: error: call to deleted constructor of
      'std::unique_ptr<MemoryBuffer>'
  struct SrcBuffer {
         ^~~~~~~~~
(The rest of the error is snipped, I'll attach it in a log.)

How to reproduce:

-- headers.hpp ---------
#include <llvm/Support/SourceMgr.h>
------------------------

-- test.cpp ------------
#include "headers.hpp"

int main() {
  return 0;
}
------------------------


Compiling with LLVM/clang 3.5.1, and using those headers, everything works as
expected:

------------------------
clang++ -I /usr/include -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS \
        -std=c++11 -x c++-header -o headers.hpp.pch headers.hpp
clang++ -std=c++11 -include headers.hpp -I /usr/include \
        -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -c -o test.o test.cpp
------------------------
(compilation flags generated with llvm-config).


However, if I use my locally-built LLVM 3.6 installation (still compiling with
clang 3.5, but it doesn't matter, I also tried with clang 3.6), it fails:

------------------------
clang++ -I ~/llvm-svn.release+assert/include -D__STDC_CONSTANT_MACROS \
        -D__STDC_LIMIT_MACROS -std=c++11 -x c++-header \
        -o headers.hpp.pch headers.hpp
clang++ -std=c++11 -include headers.hpp -I ~/llvm-svn.release+assert/include \
        -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -c -o test.o test.cpp

error: call to deleted constructor of 'std::unique_ptr<MemoryBuffer>'
------------------------


Not precompiling the header, compiling against the 3.6 headers works fine:

------------------------
clang++ -std=c++11 -I ~/llvm-svn.release+assert/include \
        -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -c -o test.o test.cpp
------------------------


Tested on LLVM 3.6, r227537. CXXFLAGS used in this report are shortened (I used
the bare minimum for readability's sake), but I also tested it with the full
set of flags generated by `llvm-config --cxxflags`.</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>