arphaman added a comment. In https://reviews.llvm.org/D26922#607186, @ahatanak wrote:
> I wonder whether it is possible to avoid calling > DeclScopeObj.EnterDeclaratorScope at ParseDecl.cpp:5317 instead of fixing > Sema::ActOnCXXEnterDeclaratorScope? > > I believe it's calling EnterDeclaratorScope to enable name lookup when a > namespace-member variable is defined outside the namespace. Since that's not > the case here, it seems to me that it shouldn't called in the first place. > > http://en.cppreference.com/w/cpp/language/unqualified_lookup Do you mean at ParseDecl:5266 (I get this line in the crash backtrace with ToT)? AFAIK it's also used for static class member lookups for variables defined outside of a class. The `OuterType` is a C++ record so that's why it should be valid to call `EnterDeclaratorScope` there. I tested to verify this and I reach that call on line 5266 with the following example 3 times: namespace Foo { extern int x; } int Foo::x = 2; // EnterDeclaratorScope is called here class Bar { public: void foo(); static int m; }; int Bar::m = 2; // here class FooBar { friend void Bar::foo(); // and here }; So it doesn't seem reasonable to required this only for namespaces. I suppose it might be better to avoid calling `EnterDeclaratorScope` anyway by moving the current context ObjC isa checks to `ShouldEnterDeclaratorScope`. Repository: rL LLVM https://reviews.llvm.org/D26922 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits