<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 --- - CRTP with inhered template member function is not included in overload resolution"
   href="https://llvm.org/bugs/show_bug.cgi?id=31406">31406</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CRTP with inhered template member function is not included in overload resolution
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>pedro.ferreira@imgtec.com
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following C++ source file compiles fine:

=======
#include <type_traits>
#include <cstdint>

template<typename Base, typename A>
class EnumAlias
{
public:
    template<typename E, typename std::enable_if<std::is_enum<E>::value>::type*
= nullptr>
    void operator()(E& e)
    {
        Base& base = *static_cast<Base*>(this);
        A& a = (A&)(e);
        base(a);
    }
};

class Base;
typedef EnumAlias<Base, uint32_t> EnumAliasU32;

class Base : public EnumAliasU32
{
public:
    using EnumAliasU32::operator();

    template<typename T, typename
std::enable_if<std::is_fundamental<T>::value>::type* = nullptr>
    void operator()(const T& e)
    {
        //something, whatever
    }
};

enum SomeEnumTy {};

void Use()
{
    SomeEnumTy e;

    Base b;
    b(e);
}
========



However, if one is to remove "const" from Base::operator(), clang fails with

=======
CRTP.cpp:39:2: error: no matching function for call to object of type 'Base'
        b(e);
        ^
CRTP.cpp:25:47: note: candidate template ignored: disabled by 'enable_if' [with
T = SomeEnumTy]
        template<typename T, typename
std::enable_if<std::is_fundamental<T>::value>::type* = nullptr>
                                                     ^
1 error generated.
=======

G++ accepts the code. Is the input source incorrect?
It seems on the second, the inherited function does not participate in overload
resolution (even though it does when "const" is specified).</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>