Skip to content

Methods with template-typed arguments #36

@termi-official

Description

@termi-official

For this MWE I modified TestTemplate2

namespace N {

template<typename T>
class A {
public: 
  A(): a(0){}

  T getval(){ return a;}
  
  void setval(const T& val){ a = val; }
  T& operator[](int i) { return a; }
  T a;
};

template class A<int>;

void g(A<int>& a) { }

class B {
public:
    void f(A<int>& a) { a = data; }
    A<int> data;
};

}

and set auto_veto = true in the ".wit" toml.

Interestingly, read write access for B::data is generated, but faulty, whereas B::f is skipped. I tried to track this one down myself, but I cannot exactly pin down what leads to this failure.

Using auto_veto = false and this file here

namespace N {

template<typename T>
class A {
public: 
  A(): a(0){}

  T getval(){ return a;}
  
  void setval(const T& val){ a = val; }
  T a;
};

template class A<int>;

void g(A<int>& a) { }

class B {
public:
    void f(A<int>& a) { a = data; }
    A<int> data;
};

}

generates B::F, but the access to data is still broken.

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