[all-commits] [llvm/llvm-project] c894e8: In MSVC compatibility mode, handle unqualified tem...

Fred Tingaud via All-commits all-commits at lists.llvm.org
Thu May 5 07:03:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c894e85fc64dd8d83b460de81080fff93c5ca334
      https://github.com/llvm/llvm-project/commit/c894e85fc64dd8d83b460de81080fff93c5ca334
  Author: Fred Tingaud <frederic.tingaud at sonarsource.com>
  Date:   2022-05-05 (Thu, 05 May 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDeclCXX.cpp
    A clang/test/SemaTemplate/ms-unqualified-base-class.cpp

  Log Message:
  -----------
  In MSVC compatibility mode, handle unqualified templated base class initialization

Before C++20, MSVC was supporting not mentioning the template argument of the base class when initializing a class inheriting a templated base class.
So the following code compiled correctly:
```
template <class T>
class Base {
};

template <class T>
class Derived : public Base<T> {
public:
  Derived() : Base() {}
};

void test() {
    Derived<int> d;
}
```
See https://godbolt.org/z/Pxxe7nccx for a conformance view.

This patch adds support for such construct when in MSVC compatibility mode.

Reviewed By: rnk

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




More information about the All-commits mailing list