Skip to content

Template Deduction Situationally Fails #106

@jszaday

Description

@jszaday

This is a broader C++ code-gen issue -- relating to the use of shared pointers and their impact on type deduction when dealing with polymorphic types. It manifests as follows, and can be solved through explicit specialization of the relevant function calls. The Ergoline compile will have to bear the brunt of this, generating specializations in the latter case.

generate.cc:212:88: error: no matching function for call to ‘ergoline::iterator<int>::zip(std::shared_ptr<ergoline::range<int> >)’
212 |       auto it_ =azbs->zip(std::make_shared<ergoline::range<int>>(ergoline::int_to(0,n)));
    |                                                                                        ^
generate.cc:58:68: note: candidate: ‘template<class B> std::shared_ptr<ergoline::iterator<std::tuple<A, B> > > ergoline::iterator<A>::zip(std::shared_ptr<ergoline::iterable<B> >) [with B = B; A = int]’
58 |     template<typename B>std::shared_ptr<iterator<std::tuple<A, B>>>zip(std::shared_ptr<iterable<B>>bs){
    |                                                                    ^~~
generate.cc:58:68: note:   template argument deduction/substitution failed:
generate.cc:212:88: note:   mismatched types ‘ergoline::iterable<A>’ and ‘ergoline::range<int>’
212 |       auto it_ =azbs->zip(std::make_shared<ergoline::range<int>>(ergoline::int_to(0,n)));
    |                                                                                        ^
generate.cc:61:68: note: candidate: ‘template<class B> std::shared_ptr<ergoline::iterator<std::tuple<A, B> > > ergoline::iterator<A>::zip(std::shared_ptr<ergoline::iterator<B> >) [with B = B; A = int]’
61 |     template<typename B>std::shared_ptr<iterator<std::tuple<A, B>>>zip(std::shared_ptr<iterator<B>>bs){
    |                                                                    ^~~
generate.cc:61:68: note:   template argument deduction/substitution failed:
generate.cc:212:88: note:   mismatched types ‘ergoline::iterator<A>’ and ‘ergoline::range<int>’
212 |       auto it_ =azbs->zip(std::make_shared<ergoline::range<int>>(ergoline::int_to(0,n)));
    |                                                                                        ^

Metadata

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