[all-commits] [llvm/llvm-project] ba1c39: MSVC compatibility mode: fix error on unqualified ...

Balazs Benics via All-commits all-commits at lists.llvm.org
Tue Aug 16 08:10:32 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba1c396e09a6dc56d817df0d378f3c826bbacaaa
      https://github.com/llvm/llvm-project/commit/ba1c396e09a6dc56d817df0d378f3c826bbacaaa
  Author: Fred Tingaud <frederic-tingaud at sonarsource.com>
  Date:   2022-08-16 (Tue, 16 Aug 2022)

  Changed paths:
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/test/SemaTemplate/ms-unqualified-base-class.cpp

  Log Message:
  -----------
  MSVC compatibility mode: fix error on unqualified templated base class initialization in case of partial specialization

I introduced a patch to handle unqualified templated base class
initialization in MSVC compatibility mode:
https://reviews.llvm.org/rGc894e85fc64dd8d83b460de81080fff93c5ca334
We identified a problem with this patch in the case where the base class
is partially specialized, which can lead to triggering an assertion in
the case of a mix between types and values.
The minimal test case is:

  template <typename Type, int TSize> class Vec {};
  template <int TDim> class Index : public Vec<int, TDim> {
    Index() : Vec() {}
  };
  template class Index<0>;

The detailed problem is that I was using the
`InjectedClassNameSpecialization`, to which the class template arguments
were then applied in order. But in the process, we were losing all the
partial specializations of the base class and creating an index mismatch
between the expected and passed arguments.

Patch By: frederic-tingaud-sonarsource

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D130709




More information about the All-commits mailing list