<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 --- - SFINAE in <cmath> not doing its job"
   href="http://llvm.org/bugs/show_bug.cgi?id=21083">21083</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SFINAE in <cmath> not doing its job
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Solaris
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kaballo86@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>JordiGH at ##c++ reported a regression in 3.5 and afterwards, that boils down
to this:

    #include <cmath>
    #include <type_traits>

    struct foo : std::true_type // for ADL
    {
      operator double() const { return 0; }
      operator float() const { return 0; }
    };

    foo pow(foo, int){ return {}; }

    int main() {
      pow(foo{}, 5); // error: call to '__test' is ambiguous at
type_traits:1195
    }

This is due to the `enable_if` in the generic overload of `std::pow` (as well
as others in that header):

    template <class _A1, class _A2>
    inline _LIBCPP_INLINE_VISIBILITY
    typename enable_if
    <
        is_arithmetic<_A1>::value &&
        is_arithmetic<_A2>::value,
        typename __promote<_A1, _A2>::type
    >::type
    pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT

Note that `_promote<_A1, _A2>` is instantiated regardless of whether `_A1` and
`_A2` are arithmetic, which results in the ambiguous overload error.</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>