Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 418
    • Issues 418
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #1521
Closed
Open
Issue created Dec 13, 2019 by Oliver Perks@olly.perks

IListStream scope issue with Foam::List

Summary

Scope issue with List in IListStream.H.

Whilst testing a new compiler release we encountered a build issue with IListStream.H, line 161.

The use of List<char>&& buffer, tries to inherit List<char> from Detail::IListStreamAllocator. However, this is a private member, and so can not be used. I believe the correct usage should be of Foam::list.

I have raised this with our internal compiler team, and they believe this to be a code issue rather than a compiler issue.

I believe this relates the the issue shown https://stackoverflow.com/questions/41595208/accessing-the-name-of-a-private-inherited-class-from-a-subclass

Steps to reproduce

This issue was encountered when building OpenFOAM 1906 with the Arm Compiler for Linux 20.0 (LLVM 9 based). So I believe this to be an issue for Clang 9. Simply building with the new compiler 20.0 encountered this issue - as LLVM 9 is being stricter. This was not an issue with the previous version 19.3 (LLVM 7 based) - nor GCC.

Example case

I have reduced the relevant files to the included MWE. List_20.0.tar.gz

> clang++ -std=c++11 -mcpu=native -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-undefined-var-template -Wno-unknown-warning-option  -O3  -I. -fPIC -c reproducer.C
In file included from reproducer.C:1:
./IListStream.H:103:10: error: 'List' is a private member of 'Foam::List<char>'
         List<char>&& buffer
         ^
./IListStream.H:61:5: note: constrained by private inheritance here
    private List<char>
    ^~~~~~~~~~~~~~~~~~
./List.H:65:7: note: member is declared here
class List
      ^
1 error generated.

What is the current bug behaviour?

As shown above, the attempt is made to scope List<char> from the wrong source - IListStreamAllocator.

What is the expected correct behavior?

List<char> should be sourced from List.H.

Relevant logs and/or images

Environment information

  • OpenFOAM version : v1906
  • Operating system : RHEL 7 + 8
  • Hardware info : Arm (aarch64)
  • Compiler : clang 9 (armclang from Arm Compiler for Linux 20.0)

Possible fixes

https://develop.openfoam.com/Development/openfoam/blob/master/src/OpenFOAM/db/IOstreams/memory/IListStream.H#L161

Before:

List<char>&& buffer,

After:

Foam::List<char>&& buffer,

Edited Dec 13, 2019 by Oliver Perks
Assignee
Assign to
Time tracking