[PATCH] D99181: [analyzer] Fix crash on spaceship operator (PR47511)

Loïc Joly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 6 07:29:29 PDT 2021


loic-joly-sonarsource added inline comments.


================
Comment at: clang/test/Analysis/PR47511.cpp:5
+
+#include "Inputs/std-compare.h"
+
----------------
For such a simple test, there is no need to use the full-fledged header, the following would suffice:
```
namespace std { 
struct strong_ordering {
  int n;
  constexpr operator int() const { return n; }
  static const strong_ordering equal, greater, less;
};
constexpr strong_ordering strong_ordering::equal = { 0 };
constexpr strong_ordering strong_ordering::greater = { 1 };
constexpr strong_ordering strong_ordering::less = { -1 };
} // namespace std
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99181



More information about the cfe-commits mailing list