<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 --- - libclang/Windows: exceptions are not supported by default [regression from 3.6.2]"
   href="https://llvm.org/bugs/show_bug.cgi?id=27324">27324</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libclang/Windows: exceptions are not supported by default [regression from 3.6.2]
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.8
          </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>libclang
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nikolai.kosjar@theqtcompany.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>libclang 3.6.2 on Windows can parse code with exceptions just fine, whereas lib
clang 3.8.0 produces "error: cannot use 'try' with exceptions disabled".

Providing -### as argument shows that libclang 3.8.0 does not have the
corresponding options -fcxx-exceptions and -fexceptions internally (libclang
3.6.2 did).

This forces libclang clients to explicitly pass in those options in order to
parse MSVC headers.



Details:

Given the following program making use of libclang:

  #include <clang-c/Index.h>

  #include <cstdlib>
  #include <cstdio>

  int main(int argc, char *argv[])
  {
      if (argc != 2) {
          fprintf(stderr, "Usage: $0 <file>\n");
          return 0;
      }

      CXIndex index = clang_createIndex(0, /*displayDiagnostics*/ 1);
      clang_parseTranslationUnit(index, argv[1], 0, 0, NULL, 0, 0);

      return 0;
  }

and the sample "inputfile.cpp":

  int main()
  {
      try { } catch (...) {}
  }

shows that:

libclang 3.8.0:

 $ libclangclient.exe intputfile.cpp:
 inputfile.cpp:3:5: error: cannot use 'try' with exceptions disabled
 $

libclang 3.6.2:

 $ libclangclient.exe intputfile.cpp:
 $</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>