[PATCH] D147263: Fix an assertion failure in unwrapSugar

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 12 04:56:49 PDT 2023


mizvekov added inline comments.


================
Comment at: clang/test/SemaObjCXX/arc-objc-lifetime.mm:69-79
+// See https://github.com/llvm/llvm-project/issues/61419
+
+template <class T0, class T1> struct pair {
+  T0 first;
+  T1 second;
+};
+
----------------
I think the fix looks good, although this test may be out of place in this file.

Ideally, if I had thought of this test case, it would have gone into `clang/test/SemaCXX/sugared-auto.cpp`.

The existing tests there would try to trigger this bug through return type deduction, and not through the ternary operator as in your reduction.

A second good option would be to add it to `clang/test/SemaCXX/sugar-common-types.cpp`, as that tests ternary operator cases, but you would have to extend the compile flags to accept the ObjC++ stuff.

Also, if you want to add an isolated test for a bug in a file where it otherwise doesn't follow the style of the existing tests, we would isolate it in a namespace named after the PR.

Something like:
```
namespace PR61419 {
....
} // namespace PR61419
```

This makes it easier to extend and not accidentally break existing tests.

Also, it looks like this test could be a bit more minimal, as suggested in the edit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147263



More information about the cfe-commits mailing list