[PATCH] D137263: add boundary check for ASTUnresolvedSet::erase
zhouyizhou via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 5 17:27:11 PDT 2022
zhouyizhou added a comment.
In D137263#3909722 <https://reviews.llvm.org/D137263#3909722>, @MaskRay wrote:
> I find that if I comment out ` cast<CXXRecordDecl>(Shadow->getDeclContext())->removeConversion(Shadow);` in `Sema::HideUsingShadowDecl`, no test fails... So we have a missing coverage issue.
Hi
I found a counterexample for above case, excited! ! and I could not hesitate to report you that good news ;-)
struct A
{
struct Nested {};
operator Nested*() {return 0;};
};
struct B : A
{
using A::operator typename A::Nested*;
operator typename A::Nested *() {
struct A * thi = this;
return *thi;
};
};
int
main()
{
struct B b;
auto s = *b;
}
After comment out ` cast<CXXRecordDecl>(Shadow->getDeclContext())->removeConversion(Shadow);`
clang++ report following:
using.C:21:11: error: use of overloaded operator '*' is ambiguous (operand type 'struct B')
auto s = *b;
^~
using.C:21:11: note: because of ambiguity in conversion of 'struct B' to 'A::Nested *'
using.C:4:9: note: candidate function
operator Nested*() {return 0;};
^
using.C:10:9: note: candidate function
operator typename A::Nested *() {
^
using.C:21:11: note: built-in candidate operator*(struct A::Nested *)
auto s = *b;
^
using.C:21:11: note: built-in candidate operator*(const struct A::Nested *)
1 error generated.
So I think we could add above to the test case.
What's your opinion?
I learned a lot under your guidance!
Thank you both
Sincerely
Zhouyi
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137263/new/
https://reviews.llvm.org/D137263
More information about the cfe-commits
mailing list