<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 --- - Clang tutorial # 2 crash"
   href="http://llvm.org/bugs/show_bug.cgi?id=17641">17641</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang tutorial # 2 crash
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicmail777@yahoo.com
          </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>I've downloaded and compiled tutorial from here:
<a href="https://github.com/loarabia/Clang-tutorial/blob/master/tutorial2.cpp">https://github.com/loarabia/Clang-tutorial/blob/master/tutorial2.cpp</a>

For input, I've a simple "hello world", with one #include
(The #include is part of the problem)

The program crashes here:
file: Lex\HeaderSearch.h
code: 
-----------------------------------------------------
HeaderSearchOptions &getHeaderSearchOpts() const { 
      return *HSOpts;  <-- crash
  }
-----------------------------------------------------
because HSOpts is null.

My bypass was to change the tutorial example,
from:
llvm::IntrusiveRefCntPtr<clang::HeaderSearchOptions> hso;
to:
llvm::IntrusiveRefCntPtr<clang::HeaderSearchOptions> hso(new
clang::HeaderSearchOptions);

(ignore the memory leak)

But the issue is the crash is not nice welcome when you try a tutorial (:

Anyways, Clang is very good and thanks for everyone who work on this project !</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>