Handle templates with implicit constructors and destructors

Open
#1,253 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp, csharp
Domain
tooling

Research direction

Start with the explicit-instantiation examples in QtCore-symbols.cpp and the StringResult declaration in qcborstream.h, then review the linked explanation of implicit constructors and destructors. The issue is done only once the project has a decided, tested behavior for these templates, such as warning the user or mapping them to C# structures without native symbols.

Written by the indexing model from the issue text.

Description

Code such as:

template <typename Container> struct StringResult {
    Container data;
    StringResultCode status = Error;
};
template struct QCborStreamReader::StringResult<QString>;

yields no symbols for constructors or destructors. Code such as:

template QCborStreamReader::StringResult<QString>::StringResult();

, on the other hand, produces this error:

QtCore-symbols.cpp:6142:52: error: explicit instantiation refers to member function 'QCborStreamReader::StringResult<QString>::StringResult' that is not an instantiation
qcborstream.h:149:42: note: explicit instantiation refers here

The explanation is here. This means we can do nothing to get the symbols and look for some other way. We could warn the user, or map such classes to simple C# structures so that native code is never involved.

Dominant language
C#
Stars
3.4k
Forks
541
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mono/CppSharp

All issues in mono/CppSharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.