zhouyizhou updated this revision to Diff 473509. zhouyizhou added a comment.
Thank Ray for your guidance! I achieved a lot in the process ;-) Thanks Zhouyi CHANGES SINCE LAST ACTION https://reviews.llvm.org/D137263/new/ https://reviews.llvm.org/D137263 Files: clang/include/clang/AST/ASTUnresolvedSet.h clang/test/SemaCXX/using-decl-templates.cpp Index: clang/test/SemaCXX/using-decl-templates.cpp =================================================================== --- clang/test/SemaCXX/using-decl-templates.cpp +++ clang/test/SemaCXX/using-decl-templates.cpp @@ -102,6 +102,28 @@ }; } // namespace DontDiagnoseInvalidTest +namespace shadow_nested_operator { + template <typename T> + struct A { + struct Nested {}; + operator Nested*() {return 0;}; + }; + + template <typename T> + struct B : A<T> { + using A<T>::operator typename A<T>::Nested*; + operator typename A<T>::Nested *() { + struct A<T> * thi = this; + return *thi; + }; + }; + + int foo () { + struct B<int> b; + auto s = *b; + } +} // namespace shadow_nested_operator + namespace func_templ { namespace sss { double foo(int, double); Index: clang/include/clang/AST/ASTUnresolvedSet.h =================================================================== --- clang/include/clang/AST/ASTUnresolvedSet.h +++ clang/include/clang/AST/ASTUnresolvedSet.h @@ -69,7 +69,12 @@ return false; } - void erase(unsigned I) { Decls[I] = Decls.pop_back_val(); } + void erase(unsigned I) { + if (I == Decls.size() - 1) + Decls.pop_back(); + else + Decls[I] = Decls.pop_back_val(); + } void clear() { Decls.clear(); }
Index: clang/test/SemaCXX/using-decl-templates.cpp =================================================================== --- clang/test/SemaCXX/using-decl-templates.cpp +++ clang/test/SemaCXX/using-decl-templates.cpp @@ -102,6 +102,28 @@ }; } // namespace DontDiagnoseInvalidTest +namespace shadow_nested_operator { + template <typename T> + struct A { + struct Nested {}; + operator Nested*() {return 0;}; + }; + + template <typename T> + struct B : A<T> { + using A<T>::operator typename A<T>::Nested*; + operator typename A<T>::Nested *() { + struct A<T> * thi = this; + return *thi; + }; + }; + + int foo () { + struct B<int> b; + auto s = *b; + } +} // namespace shadow_nested_operator + namespace func_templ { namespace sss { double foo(int, double); Index: clang/include/clang/AST/ASTUnresolvedSet.h =================================================================== --- clang/include/clang/AST/ASTUnresolvedSet.h +++ clang/include/clang/AST/ASTUnresolvedSet.h @@ -69,7 +69,12 @@ return false; } - void erase(unsigned I) { Decls[I] = Decls.pop_back_val(); } + void erase(unsigned I) { + if (I == Decls.size() - 1) + Decls.pop_back(); + else + Decls[I] = Decls.pop_back_val(); + } void clear() { Decls.clear(); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits