[clang] [clang] remove ClassScopeFunctionSpecializationDecl (PR #66636)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 18 08:21:40 PDT 2023


sdkrystian wrote:

@erichkeane 
> I guess my first question is 'why'? 

Per the comment you mentioned, it is redundant. Switching to `DependentFunctionTemplateSpecializationInfo` also results in constructs such as:

```
template<typename T>
struct A {
  template<>
  void f();
};
```

being diagnosed prior to instantiation. Class scope explicit specializations currently exist in their own broken little corner of the frontend, so unifying their representation in the AST would be the first step towards properly fixing them. 

> My second is 'if this is unnecessary, why was it here in the first place?`. 

`ClassScopeFunctionSpecializationDecl` was originally added in [this commit](https://github.com/llvm/llvm-project/commit/00c7e6ceb1826baab50c02f8547e97bfcaf9641c) to "parse MSVC standard C++ headers, MFC and ATL code." Back then, class scope explicit specializations were a Microsoft extension, but since [CWG727](https://wg21.link/cwg727) they are valid ISO C++. As for why this was not originally implemented using `DependentFunctionTemplateSpecializationInfo`, I cannot say.

https://github.com/llvm/llvm-project/pull/66636


More information about the cfe-commits mailing list