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

Problematic generation with multiple templates #1413

Closed
stuglaser opened this issue Dec 28, 2024 · 1 comment · Fixed by #1423
Closed

Problematic generation with multiple templates #1413

stuglaser opened this issue Dec 28, 2024 · 1 comment · Fixed by #1423

Comments

@stuglaser
Copy link
Contributor

I think I've found a case where autocxx mishandles multiple templates together (or it might be mishandling the default template):

class Thinger {
};

template <class T>
class RefPtr {
private:
    T* m_ptr;
};

class Container {
    void* data_;
};

class FakeAlloc {

};

template <typename T, typename A=FakeAlloc>
class Holder {
    A alloc;
};


typedef Holder<RefPtr<Thinger>> ThingerRefHolder;
class Problem {
public:
    ThingerRefHolder& getThingers();
};

This gives an error on build:

  cargo:warning=.../out/autocxx-build-dir/cxx/gen0.cxx: In function 'Holder_FakeAlloc_AutocxxConcrete* cxxbridge1$Problem$getThingers(Problem&)':
  cargo:warning=.../target/debug/build/repro-templvec-2d1a543db79e0eca/out/autocxx-build-dir/cxx/gen0.cxx:185:70: error: cannot convert 'ThingerRefHolder& (Problem::*)()' {aka 'Holder<RefPtr<Thinger> >& (Problem::*)()'} to 'Holder_FakeAlloc_AutocxxConcrete& (Problem::*)()' {aka 'Holder<FakeAlloc>& (Problem::*)()'} in initialization
  cargo:warning=  185 |   ::Holder_FakeAlloc_AutocxxConcrete &(::Problem::*getThingers$)() = &::Problem::getThingers;
  cargo:warning=      |                                                                      ^~~~~~~~~~~~~~~~~~~~~~~

I don't quite understand it, but I think the generation is skipping over the first template argument, and naming the type after only the second?

@adetaylor
Copy link
Collaborator

Thanks, please raise a PR with a test case.

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

Successfully merging a pull request may close this issue.

2 participants