[metacling] Handle autotypes in collect_type_info#19133
Draft
aaronj0 wants to merge 1 commit into
Draft
Conversation
Canonicalizing a type that is an alias to a template type which uses a private struct loses the sugar that makes the type accesible.
```
template<class T>
class Container {};
class Foo {
private:
struct Tag;
public:
using iterator = Container<Tag>;
auto begin() {
return iterator{};
}
};
```
calling `begin` on an instance of `Foo` gives us:
```
extern "C" void __cf_12(void* obj, int nargs, void** args, void* ret)
{
if (ret) {
// CallFunc does:
// new (ret) (Container<Foo::Tag>) (((Foo*)obj)->begin());
// What should be used:
new (ret) (Foo::iterator) (((Foo*)obj)->begin());
return;
}
else {
(void)(((Foo*)obj)->begin());
return;
}
}
```
Test Results 20 files 20 suites 3d 22h 11m 5s ⏱️ For more details on these failures, see this check. Results for commit 1397502. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In CallFunc, we canonicalise types before collecting their typeinfo and names. However, if we have an alias to a template type which uses a private struct, this causes us to lose the sugar that makes the type accessible since the struct is private.
calling
beginon an instance ofFoogives us:This PR should fix #18837 (will add tests)