[all-commits] [llvm/llvm-project] c7fbe2: Fix rejects-valid when referencing an implicit ope...

Richard Smith via All-commits all-commits at lists.llvm.org
Wed Jun 17 15:12:25 PDT 2020


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

  Changed paths:
    M clang/include/clang/AST/DeclBase.h
    M clang/include/clang/Sema/Template.h
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/test/PCH/cxx2a-defaulted-comparison.cpp
    A clang/test/SemaTemplate/defaulted.cpp

  Log Message:
  -----------
  Fix rejects-valid when referencing an implicit operator== from within a
templated class.

When a defaulted operator<=> results in the injection of a defaulted
operator==, that operator== can be named by unqualified name within the
same class, even if the class is templated. To make this work, perform
the transform from defaulted operator<=> to defaulted operator== in the
template definition context instead of the template instantiation
context.

This results in our substituting into a declaration from a context where
we don't have a full list of template arguments (or indeed any), for
which we are now more careful to not spuriously instantiate declarations
that are not dependent on the arguments we're substituting.


  Commit: c851d6cf4a4ab803d01d0059f4659f4f9f4435ea
      https://github.com/llvm/llvm-project/commit/c851d6cf4a4ab803d01d0059f4659f4f9f4435ea
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-06-17 (Wed, 17 Jun 2020)

  Changed paths:
    M clang/lib/Sema/SemaTemplate.cpp

  Log Message:
  -----------
  When performing a substitution into a dependent alias template, mark the
outer levels as retained rather than omitting their arguments.

This better reflects what's going on (we're performing a substitution
while still inside a template). In theory this is also more correct, but
I've not found a testcase where it matters in practice (largely because
we don't allow alias templates to be declared inside a function).


Compare: https://github.com/llvm/llvm-project/compare/771b7886872e...c851d6cf4a4a


More information about the All-commits mailing list