[all-commits] [llvm/llvm-project] d14460: DR458: Search template parameter scopes in the rig...

Richard Smith via All-commits all-commits at lists.llvm.org
Tue Jun 23 17:14:55 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d1446017f3fdc2f6a9efba222008d20afa1e26cc
      https://github.com/llvm/llvm-project/commit/d1446017f3fdc2f6a9efba222008d20afa1e26cc
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-06-23 (Tue, 23 Jun 2020)

  Changed paths:
    M clang/include/clang/Parse/Parser.h
    M clang/include/clang/Sema/Scope.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/Parse/ParseCXXInlineMethods.cpp
    M clang/lib/Parse/ParseDeclCXX.cpp
    M clang/lib/Parse/ParseExprCXX.cpp
    M clang/lib/Parse/ParseOpenMP.cpp
    M clang/lib/Parse/ParseTemplate.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/test/CXX/drs/dr4xx.cpp
    M clang/test/CXX/temp/temp.res/temp.local/p8.cpp
    M clang/test/SemaCXX/lambda-expressions.cpp
    M clang/www/cxx_dr_status.html

  Log Message:
  -----------
  DR458: Search template parameter scopes in the right order.

C++ unqualified name lookup searches template parameter scopes
immediately after finishing searching the entity the parameters belong
to. (Eg, for a class template, you search the template parameter scope
after looking in that class template and its base classes and before
looking in the scope containing the class template.) This is complicated
by the fact that scope lookup within a template parameter scope looks in
a different sequence of places prior to reaching the end of the
declarator-id in the template declaration.

We used to approximate the proper lookup rule with a hack in the scope /
decl context walk inside name lookup. Now we instead compute the lookup
parent for each template parameter scope.

In order to get this right, we now make sure to enter a distinct Scope
for each template parameter scope, and make sure to re-enter the
enclosing class scopes properly when handling delay-parsed regions
within a class.




More information about the All-commits mailing list