<html>
    <head>
      <base href="https://bugs.llvm.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 - clang++ does not match templates with inheritance"
   href="https://bugs.llvm.org/show_bug.cgi?id=33995">33995</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang++ does not match templates with inheritance
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>mcalhoun@macports.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While attempting to compile a project called VIGRA
(<a href="https://github.com/macports/macports-ports/tree/master/graphics/vigra">https://github.com/macports/macports-ports/tree/master/graphics/vigra</a>):
   * using /usr/bin/clang++ worked (Apple provided Clang)
   * using /opt/local/bin/g++-mp-6 worked (GCC version 6.3.0)
   * using /opt/local/bin/clang++-mp-4.0 Failed (Clang 4.0.1)
   * using /opt/local/bin/clang++-mp-5.0 Failed (Clang 5.0)

GCC and Clang are built using MacPorts (<a href="https://www.macports.org">https://www.macports.org</a>).
/usr/bin/clang++ is provided by Apple and is version 8.1.0.

------------------------------------------------------------------------------
The locally built clang++ gives me the error:
------------------------------------------------------------------------------
test.cxx:35:5: error: no matching function for call to
'gaussianDivergenceMultiArray'
    gaussianDivergenceMultiArray(array, res);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cxx:40:1: note: in instantiation of function template specialization
'pythonGaussianDivergence<double, 2>' requested here
pythonGaussianDivergence<double,2>(NumpyArray<2, TinyVector<double, 2> > array,
^
test.cxx:13:1: note: candidate template ignored: could not match
'MultiArrayView' against 'NumpyArray'
gaussianDivergenceMultiArray(MultiArrayView<N, TinyVector<T1, N> > const &
vectorField,
^
1 error generated.
------------------------------------------------------------------------------


------------------------------------------------------------------------------
The smallest test case I can get it down is:
------------------------------------------------------------------------------
template <unsigned N, class T>
class MultiArrayView
{
};

template <class T, int SIZE>
class TinyVector
{
};

template <unsigned N, class T1, class T2>
inline void
gaussianDivergenceMultiArray(MultiArrayView<N, TinyVector<T1, N> > const &
vectorField,
                             MultiArrayView<N, T2> divergence)
{
}

template<unsigned N, class T>
struct NumpyArrayTraits
{
    typedef T value_type;
};

template <unsigned N, class T>
class NumpyArray
: public MultiArrayView<N, typename NumpyArrayTraits<N, T>::value_type>
{
};

template <class PixelType, unsigned N>
void
pythonGaussianDivergence(NumpyArray<N, TinyVector<PixelType, N> > array,
                         NumpyArray<N, double > res)
{
    gaussianDivergenceMultiArray(array, res);
}

template
void
pythonGaussianDivergence<double,2>(NumpyArray<2, TinyVector<double, 2> > array,
                                   NumpyArray<2, double > res);
------------------------------------------------------------------------------</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>