[PATCH] D124666: In MSVC compatibility mode, handle unqualified templated base class initialization

Fred Tingaud via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 03:26:26 PDT 2022


frederic-tingaud-sonarsource created this revision.
frederic-tingaud-sonarsource added a reviewer: rnk.
Herald added a project: All.
frederic-tingaud-sonarsource requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124666

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaTemplate/ms-unqualified-base-class.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124666.426009.patch
Type: text/x-patch
Size: 4454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220429/f3ec65ea/attachment.bin>


More information about the cfe-commits mailing list