Skip to content

RDF Book() fails to compile with ambiguous calls in Exec with zero arguments #15263

Open
@hahnjo

Description

@hahnjo

Description

For jitted Book(), ie not giving compiled column types, it fails to compile if the Exec instantiation is available, but contains itself an ambiguous call. Specifying an explicit column type or forcing at least one argument to Exec makes it work.

Reproducer

#include <ROOT/RDataFrame.hxx>

#include <memory>

struct Result {
  template <typename... A>
  void Fill(A... a) {}
  template <typename... A>
  void Fill(typename A::type... a) {}
};

class Helper : public ROOT::Detail::RDF::RActionImpl<Helper> {
public:
  using Result_t = Result;

private:
  std::shared_ptr<Result_t> fResult;

public:
  Helper() {
    fResult = std::make_shared<Result_t>();
  }
  Helper(const Helper &) = delete;
  Helper(Helper &&) = default;
  std::shared_ptr<Result_t> GetResultPtr() const { return fResult; }
  void Initialize() {}
  void InitTask(TTreeReader *, unsigned int) {}
  template <typename... ColumnTypes>
  void Exec(unsigned int, ColumnTypes... values) {
    fResult->Fill(values...);
  }
  void Finalize() {}
  std::string GetActionName() const { return "Helper"; }
};

int main() {
  ROOT::RDataFrame df(1);
  df.Book(Helper{}, {"rdfentry_"});

  return 0;
}

gives with GCC 8.5.0:

book.cxx:30:5: error: call of overloaded ‘Fill()’ is ambiguous
     fResult->Fill(values...);
     ^~~~~~~
book.cxx:7:8: note: candidate: ‘void Result::Fill(A ...) [with A = {}]’
   void Fill(A... a) {}
        ^~~~
book.cxx:9:8: note: candidate: ‘void Result::Fill(typename A::type ...) [with A = {}]’
   void Fill(typename A::type... a) {}
        ^~~~

ROOT version

master

Installation method

from source

Operating system

Linux

Additional context

As discussed, not critical right now (also in the reproducer, the Helper type would have to be known to the interpreter for it to work at run-time). Also not sure if this can be fixed at all or if this is a direct consequence of resolving the ambiguity to support Book() without any columns, which requires a run-time check...

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions