Exposed global variable in cling

A simple variable name created in a ROOT interactive session clashes unexpectedly with a variable exposed by Cling.
Seen in ROOT 6.34.02
Built for linuxx8664gcc on Dec 25 2024, 00:00:00
From tags/6-34-02@6-34-02
Standard version from fedora repository for fedora 41.

To reproduce.

  1. Just run ROOT
  2. see commands and output copied below.
    root [1] auto x1 = 5.0;
    root [2] x1
    (double) 5.0000000
    root [3] auto y1 = 7.0;
    root [4] y1
    ROOT_prompt_4:1:1: error: reference to ‘y1’ is ambiguous
    y1
    ^
    ROOT_prompt_3:1:6: note: candidate found by name lookup is ‘__cling_N52::y1’
    auto y1 = 7.0;
    ^
    /usr/include/bits/mathcalls.h:239:13: note: candidate found by name lookup is ‘y1’
    __MATHCALL (y1, (Mdouble));
    ^
    root [5]

Why should a simple variable name like y1 cause a problem?

Related issues:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.