Skip to content

Fail to compile at MSVC when using eigen wrapper #35

Open
@hyuny223

Description

Hello. I'm trying to use Eigen wrapper. Every environment is okay except MSVC.

process : intel, 64bit
c++ compiler : clang++(15.0.7)
Generator : Visual Studio 17 2022
Eigen : 3.4.0

This is my code.

#define STATS_ENABLE_STDVEC_WRAPPERS
#define STATS_ENABLE_EIGEN_WRAPPERS
#include "stats.hpp"
#include "Eigen/Dense"
#include <iostream>

int main()
{
    Eigen::Vector<double, 9> probabilities;
    probabilities << 0.24, 0.74, 0.12, 0.56, 0.81, 0.92, 0.65, 0.57, 0.35;
    for (int32_t dof = 1; dof < 10; dof++)
        auto estimated = stats::qchisq(probabilities, static_cast<double>(dof));
    return 0;
}

Only in MSVC, template type deduction fails. Following error occurs.

error C2672: 'stats::qchisq': no matching overloaded function found
3>D:\var\stats\include\stats\stats_incl\quant\qchisq.hpp(156,1): message : could be 'Eigen::Matrix<rT,iTr,iTc,0|_Rows==1&&_Cols!=1?Eigen::RowMajor:_Cols==1&&_Rows!=1?Eigen::ColMajor:Eigen::ColMajor,_Rows,_Cols> stats::qchisq(const Eigen::Matrix<eT,iTr,iTc,0|_Rows==1&&_Cols!=1?Eigen::RowMajor:_Cols==1&&_Rows!=1?Eigen::ColMajor:Eigen::ColMajor,_Rows,_Cols> &,const T1)'
message : 'Eigen::Matrix<rT,iTr,iTc,0|_Rows==1&&_Cols!=1?Eigen::RowMajor:_Cols==1&&_Rows!=1?Eigen::ColMajor:Eigen::ColMajor,_Rows,_Cols> stats::qchisq(const Eigen::Matrix<eT,iTr,iTc,0|_Rows==1&&_Cols!=1?Eigen::RowMajor:_Cols==1&&_Rows!=1?Eigen::ColMajor:Eigen::ColMajor,_Rows,_Cols> &,const T1)': could not deduce template argument for 'const T1' from 'double'
3>D:\var\stats\include\stats\stats_incl\quant\qchisq.hpp(70,1): message : or       'std::vector<rT,std::allocator<Char>> stats::qchisq(const std::vector<_Ty,std::allocator<_Ty>> &,const T1)'
message : 'std::vector<rT,std::allocator<Char>> stats::qchisq(const std::vector<_Ty,std::allocator<_Ty>> &,const T1)': could not deduce template argument for 'const std::vector<_Ty,std::allocator<_Ty>> &' from 'Eigen::Matrix<double,9,1,0,9,1>'
3>D:\var\stats\include\stats\stats_incl\quant\qchisq.hpp(46,1): message : or       'std::conditional<std::is_integral<std::common_type<_Ty1,_Ty2>::type>::value,double,std::common_type<_Ty1,_Ty2>::type>::type stats::qchisq(const T1,const T2) noexcept'
message : Failed to specialize function template 'std::conditional<std::is_integral<std::common_type<_Ty1,_Ty2>::type>::value,double,std::common_type<_Ty1,_Ty2>::type>::type stats::qchisq(const T1,const T2) noexcept'
message : With the following template arguments:
message : 'T1=Eigen::Matrix<double,9,1,0,9,1>'
message : 'T2=double'

Only it makes above error on this environment(but when using std::vector wrapper, it is fine).

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions