Skip to content

gDirectory macro should include global-namespace qualification #12623

Closed
@knoepfel

Description

@knoepfel
  • Checked for duplicates

Describe the bug

The definition of gDirectory as a macro causes problems when used inside of a namespace named ROOT.

For example, the following fails to compile with GCC 9.3 and C++17:

#include "TDirectory.h"

namespace util::ROOT {
  void foo() { auto path = gDirectory->GetPath(); }
}

Because gDirectory expands to ROOT::Internal... and not ::ROOT::Internal..., C++ name lookup chooses util::ROOT and notices that util::ROOT::Internal is non-existent.

Expected behavior

The above should compile without ambiguity. A PR is forthcoming to address this limitation.

Setup

  1. Version: ROOT 6.26/06
  2. Operating system: CentOS 7
  3. Built from source

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions