[PATCH] D113474: [clang] Don't crash on an incomplete-type base specifier in template context.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 9 07:12:29 PST 2021


hokein added inline comments.


================
Comment at: clang/test/SemaCXX/base-class-ambiguity-check.cpp:15
+  // Should not crash on an incomplete-type and dependent base specifier.
+  struct Derived : Base1, Base2 {}; // expected-error {{implicit instantiation of undefined member 'Foo2<int>::Base1'}} \
+                                       expected-error {{implicit instantiation of undefined member 'Foo2<int>::Base2'}}
----------------
The diagnostic is suboptimal (I'd expect it is "invalid use of incomplete type"), but it is not regression, clang shows the same diagnostics for the following non-crash case:

```
template <typename T> struct Foo2 {
  struct Base1;
  struct Derived : Base1 {};
}
```


================
Comment at: clang/test/SemaCXX/ms-interface.cpp:114
+  // Should not crash on an incomplete-type base specifier.
+  __interface Foo : Base {};
+};
----------------
sammccall wrote:
> is there some tricky interaction with __interface here that justifies testing this again? If it's testing the same codepath, I'd say one test is enough
They test different paths (this was founded in my previous-and-incomplete fix):
  - this tests `isInterface()` on Line 2740 in `SemaDeclCxx.cpp`;
  - the above one tests `NoteIndirectBases` (multiple base classes) on Line 2736 in `SemaDeclCXX.cpp`;


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113474/new/

https://reviews.llvm.org/D113474



More information about the cfe-commits mailing list