<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 --- - Segfault when using -g on code with struct inheriting std::chrono::duration"
   href="http://llvm.org/bugs/show_bug.cgi?id=16388">16388</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segfault when using -g on code with struct inheriting std::chrono::duration
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.3
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>1zeeky@gmail.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>Created <span class=""><a href="attachment.cgi?id=10712" name="attach_10712" title="testcase">attachment 10712</a> <a href="attachment.cgi?id=10712&action=edit" title="testcase">[details]</a></span>
testcase

I'm getting a Segfault when compiling code that instantiates a
std::chrono::time_point<clock> with clock::duration being a struct inheriting
from std::chrono::duration.

When I typedef clock::duration to std::chrono::duration, it compiles fine.
When not using -g, it compiles fine.

Additionally, not sure if this is related, some error in the code or a
different bug:
I typedef'd the std::chrono::time_point<clock>, but when not using the typedef
(so instead write out the type) I get a compiler error about clock not being a
type.

Note that instancing clock::duration does not result in any error.

The attached testcase crashes when compiling with -g (fine without -g).
You can define the NO_CRASH macro to use a typedef to std::chrono::duration
instead of a struct inheriting the type, which compiles fine.
You can also define the C_ERR macro to use std::chrono::time_point<clock>
instead of the typedef, which results in a compiler error.

I used the C++ standard-library from gcc 4.8.1 for this.</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>