Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cling::utils::Lookup::Named does not look into using directive #15407

Open
1 task
pcanal opened this issue May 2, 2024 · 0 comments · May be fixed by #15458
Open
1 task

cling::utils::Lookup::Named does not look into using directive #15407

pcanal opened this issue May 2, 2024 · 0 comments · May be fixed by #15458
Assignees

Comments

@pcanal
Copy link
Member

pcanal commented May 2, 2024

Check duplicate issues.

  • Checked for duplicates

Description

This is related to #15406

In a run of cling::utils::Lookup::Named with:

(lldb) p sofar->dumpAsDecl()
NamespaceDecl 0x12e8d0788 </Users/pcanal/root_working/test/2024-meta/test_usingenum.cxx:3:1, col:34> col:11 C
`-UsingDirectiveDecl 0x12e8d0818 <col:15, col:31> col:31 Namespace 0x12e8d0438 'A'

will not look (or at least not find) anything brought by the using directive.

This results in both TClass::GetClass and TClass::GetEnum (even after #15406 is resolved) with nothing find entity that are spelt via a using directive:

This is due to TClassEdit::GetNormalizedName is not correctly resolving the name (due to the incorrect behavior of cling::utils::Lookup::Named

Reproducer

root [0] namespace A { enum E { kOne }; class C; }
root [1] namespace B { using namespace A; }
root [2] TClass::GetClass("A::C")
Warning in <TClass::Init>: no dictionary for class A::C is available
(TClass *) 0x12fe265f0
root [3] TClass::GetClass("B::C")
(TClass *) nullptr
root [4] TEnum::GetEnum("A::E")
(TEnum *) 0x600000e64c30
root [5] TEnum::GetEnum("B::E")
(TEnum *) nullptr
namespace A { enum E { kOne }; class C; }
namespace B { using namespace A; }

int testing()
{
	auto c = TClass::GetClass("B::C");
    if (!c) 
      return 1;
   if (c != TClass::GetClass("A::E");
      return 2;

   // Should work when PR #15408 is merged but does not.
   auto e = TEnum::GetEnum("B::E")
   if (!e)
      return 3;
   if (e != TEnum::GetEnum("A::E");
      return 4;
   return 0;
}

ROOT version

v6.00+ including master

Installation method

any

Operating system

any

Additional context

A commented out part of roottest/root/enums/test_usingenum.cxx is failing due to this issue.

@pcanal pcanal added the bug label May 2, 2024
@pcanal pcanal added the in:Cling label May 2, 2024
pcanal added a commit to pcanal/roottest that referenced this issue May 2, 2024
This is testing root-project/root#15406
and can test root-project/root#15407 (be is currently disable
as the issue is not fixed)
pcanal added a commit to pcanal/roottest that referenced this issue May 6, 2024
This is testing root-project/root#15406
and can test root-project/root#15407 (be is currently disable
as the issue is not fixed)
dpiparo pushed a commit to root-project/roottest that referenced this issue May 8, 2024
This is testing root-project/root#15406
and can test root-project/root#15407 (be is currently disable
as the issue is not fixed)
pcanal added a commit to pcanal/roottest that referenced this issue May 8, 2024
This is testing root-project/root#15406
and can test root-project/root#15407 (be is currently disable
as the issue is not fixed)
pcanal added a commit to root-project/roottest that referenced this issue May 8, 2024
This is testing root-project/root#15406
and can test root-project/root#15407 (be is currently disable
as the issue is not fixed)
pcanal added a commit to pcanal/roottest that referenced this issue May 8, 2024
This is testing root-project/root#15406
and can test root-project/root#15407 (be is currently disable
as the issue is not fixed)
pcanal added a commit to root-project/roottest that referenced this issue May 8, 2024
This is testing root-project/root#15406
and can test root-project/root#15407 (be is currently disable
as the issue is not fixed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants