<html>
    <head>
      <base href="http://bugzilla.gdcproject.org/">
    </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 - Wrong gcc5 __builtin_OPNAME_overflow signatures."
   href="http://bugzilla.gdcproject.org/show_bug.cgi?id=206">206</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong gcc5 __builtin_OPNAME_overflow signatures.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>GDC
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>development
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>Normal
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>gdc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>ibuclaw@gdcproject.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>art.08.09@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>For example:

<span class="quote">> import gcc.builtins;
> pragma(msg, typeof(__builtin_add_overflow));</span >

->

  pure nothrow @nogc @safe extern (C) bool()

Which makes them unusable from D.


---------------------------------------------
void bug() {
   int r;
   __builtin_add_overflow(1, 2, &r);
}
---------------------------------------------

->

  error: function gcc.builtins.__builtin_add_overflow () is not callable using
argument types (int, int, int*)


They do work if the type is overridden; ie this hack works:

   @trusted bool overflow(string OP, A, B, R)(A a, B b, R* r) {
      import gcc.builtins;

      auto baofp = cast(typeof(&overflow))&mixin("__builtin_"~OP~"_overflow");

      return (*baofp)(a, b, r);
   }

   if (overflow!"add"(a, b, &r))
      error();</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>