llnl / llnl/shroud

Wrapping a const function that returns a pointer

Open
#136 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Fortran
Stars
97
Forks
8
PR merge metrics
No merged PRs in 30d

Description

In the references example, there is the following case:

  - decl: double* getArray() +dimension(getSize())

I ran into a problem wrapping the function if it is const, e.g.

  - decl: double* getArray() const +dimension(getSize())

The errors were of the form:

<src>.cpp: error: a value of type "const ArrayWrapper *" cannot be used to initialize an entity of type "ArrayWrapper *"
      ArrayWrapper *obj = static_cast<const ArrayWrapper *>(self->addr);

Could you please add the const versions of these functions, with shroud wrappers?

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.

Research direction

Start with the references example and the double* getArray() const +dimension(getSize()) declaration. Compare its generated wrapper with the non-const case and investigate the reported ArrayWrapper * versus const ArrayWrapper * error. Done means the const versions of these functions have working Shroud wrappers.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.