[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 13 01:13:31 PDT 2024


hokein wrote:

It does filter out the `missing-dependent-template-keyword` warnings, but doesn't fix the absl case.

With https://github.com/llvm/llvm-project/commit/ce4aada6e2135e29839f672a6599db628b53295d, there is a behavior change in clang. Clang reject the following code which was accepted before by emitting a hard error `err_no_member`.


```
#define TYPE_OR_NONTYPE int

template<TYPE_OR_NONTYPE T>
struct BaseT {
  void Foo(); // expected-note{{found by ambiguous name lookup}}
};

template<TYPE_OR_NONTYPE T>
struct DerivedT : BaseT<T> {
  void Inner();
};

template<TYPE_OR_NONTYPE T>
void DerivedT<T>::Inner() {
  this->BaseT<T>::Foo();
}
```

- If the `TYPE_OR_NONTYPE` is `typename` (type template parameter case), clang emits a `missing-dependent-template-keyword` warning, which can be suppressed;
- If the `TYPE_OR_NONTYPE` is `int` (non-type template parameter case), clang emits a hard error `err_no_member`;

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


More information about the cfe-commits mailing list