Closed Yaraslaut closed 3 months ago
Hey, @Yaraslaut ! You're probably looking at P2996R2, but note that we presented a D2996R3 for the Tokyo meeting, which includes this link to a working example from Clang/P2996. We didn't implement your use of is_accessible
to check for private base classes though, which is a nice trick.
Since that time, Robert Leahy brought to our attention that C-style casts allow one to circumvent access-checking on base classes, so the original Universal Formatter can in fact be saved. This example will be published in the next revision, complete with support for private base classes: https://godbolt.org/z/rbs6K78WG
That said, I did forget to add the example as a test case! If you'd like to open a PR adding the example linked above as a test case, I'd be happy to merge it.
Hey, @Yaraslaut ! You're probably looking at P2996R2, but note that we presented a D2996R3 for the Tokyo meeting, which includes this link to a working example from Clang/P2996. We didn't implement your use of
is_accessible
to check for private base classes though, which is a nice trick.Since that time, Robert Leahy brought to our attention that C-style casts allow one to circumvent access-checking on base classes, so the original Universal Formatter can in fact be saved. This example will be published in the next revision, complete with support for private base classes: https://godbolt.org/z/rbs6K78WG
That said, I did forget to add the example as a test case! If you'd like to open a PR adding the example linked above as a test case, I'd be happy to merge it.
Thanks for the detailed reply, I will make a PR later.
Hi, I figure out that
universal_formatter
from the proposal does not work and here is the closest I could get with the current implementation:https://godbolt.org/z/K4cGYf8qj
One important note, is that
Y
is not accessible from the instance ofZ
so formatter can not show it. It can be beneficial to have it as a part of tests/examples, so if you are open i can open a PR for this addition.