Skip to content

[core] Fix improper name normalization in KeepNParams#21567

Open
silverweed wants to merge 1 commit intoroot-project:masterfrom
silverweed:map_alloc_classedit
Open

[core] Fix improper name normalization in KeepNParams#21567
silverweed wants to merge 1 commit intoroot-project:masterfrom
silverweed:map_alloc_classedit

Conversation

@silverweed
Copy link
Contributor

@silverweed silverweed commented Mar 11, 2026

The algorithm was not recording any default arguments into argsToKeep, but it actually needs to keep them as long as they are followed by a non-default argument.

This would cause issues such as this:

// std::less<int> is a default argument, but MyAlloc is not 
using MyMap = std::map<int, int, std::less<int>, MyAlloc>;

TClass::GetClass("MyMap")->GetName() // prints "map<int,int,MyAlloc>" !

NOTE

I am not familiar with the Cling codebase so this fix might be missing something or be wrong for some other reason. The TClassEdit tests are passing, at least, but I kindly ask Cling experts to scrutinize this change thoroughly.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #

@silverweed silverweed force-pushed the map_alloc_classedit branch from aa7739b to 0fd3044 Compare March 11, 2026 11:03
@github-actions
Copy link

github-actions bot commented Mar 11, 2026

Test Results

    22 files      22 suites   3d 5h 47m 44s ⏱️
 3 807 tests  3 804 ✅ 1 💤 2 ❌
76 698 runs  76 684 ✅ 9 💤 5 ❌

For more details on these failures, see this check.

Results for commit f4e0d07.

♻️ This comment has been updated with latest results.

@silverweed silverweed force-pushed the map_alloc_classedit branch from 0fd3044 to c37967c Compare March 11, 2026 16:03
@silverweed
Copy link
Contributor Author

Test fails on mac with:

2026-03-11T17:37:05.5216310Z Expected equality of these values:
2026-03-11T17:37:05.5219690Z   "std::map<int,int>"
2026-03-11T17:37:05.5219810Z   n.c_str()
2026-03-11T17:37:05.5220220Z     Which is: "map<int,int>"

which is concerning...

The algorithm was not recording any default arguments into argsToKeep,
but it actually needs to keep them as long as they are followed by a
non-default argument.

This would cause issues such as this:

// std::less<int> is a default argument, but MyAlloc is not
using MyMap = std::map<int, int, std::less<int>, MyAlloc>;

TClass::GetClass("MyMap")->GetName() # prints "map<int,int,MyAlloc>" !
@silverweed silverweed force-pushed the map_alloc_classedit branch from c37967c to f4e0d07 Compare March 12, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants