[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 05:41:43 PDT 2024


cor3ntin wrote:

Reduced further

```cpp
template <int dim, int = dim> class DoFHandler;
template <int dim, int = dim> class FiniteElement;

template <int dim, class InVector, class OutVector, int spacedim>
void back_interpolate(const DoFHandler<dim, spacedim> &, const InVector &,
                     const FiniteElement<dim, spacedim> &, OutVector &){};

template <int dim, template <int> class DH, 
          class InVector, class OutVector,
          int spacedim>
void back_interpolate(const DH<dim> &, InVector,
                      const FiniteElement<dim, spacedim> &, OutVector){};
 

template void back_interpolate(const DoFHandler<3> &, const double &,
                               const FiniteElement<3> &, double &);
```

https://compiler-explorer.com/z/5az5s8jMh
Both GCC and Clang trunk reject that code and i believe this is the conforming behavior.

@zygoloid Do you think we should explore some sort of mitigation strategy here? (a flag to restore the old behavior?)
Looking at that code, it's unclear how either is considered a better specialization by clang 18




https://github.com/llvm/llvm-project/pull/100692


More information about the cfe-commits mailing list