[llvm-bugs] [Bug 33995] New: clang++ does not match templates with inheritance

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 30 11:06:36 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33995

            Bug ID: 33995
           Summary: clang++ does not match templates with inheritance
           Product: clang
           Version: 4.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mcalhoun at macports.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

While attempting to compile a project called VIGRA
(https://github.com/macports/macports-ports/tree/master/graphics/vigra):
   * 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 (https://www.macports.org).
/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);
------------------------------------------------------------------------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170730/c9f8fd1a/attachment.html>


More information about the llvm-bugs mailing list