Skip to content

std::array and enum issue #20181

@musinsky

Description

@musinsky
// 2025-10-23

#ifndef RFOO
#define RFOO

// without effect
// #pragma link C++ enum Foo::EState;
// #pragma link C++ enum EState;

#include <array>

class Foo : public TObject {

public:
  enum EState { kS1, kS2, kS3 };

  Foo() = default;
  ~Foo() override = default;

private:
  EState array[100] = {};              // correct
  std::array<EState, 100> array2 = {}; // wrong

  ClassDefOverride(Foo, 1) // Foo class
};

#endif
$ root
ROOT Version: 6.37.01
Built for linuxx8664gcc on Oct 23 2025, 07:01:03
From heads/master@v6-37-01-8542-g01185f03c
root [0] .L Foo.h+
root [1] TFile f("test.root", "RECREATE"); TTree t("t", "test"); Foo *event = new Foo();
root [2] t.Branch("Foo", &event)
Error in <TStreamerInfo::Build>: Foo, unknown type: Foo::EState array2

(TBranch *) 0x1545e7d0
root [3] 

Where is the problem ?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions