Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to compile at MSVC when using eigen wrapper #35

Open
hyuny223 opened this issue Aug 24, 2023 · 0 comments
Open

Fail to compile at MSVC when using eigen wrapper #35

hyuny223 opened this issue Aug 24, 2023 · 0 comments

Comments

@hyuny223
Copy link

hyuny223 commented Aug 24, 2023

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant