================
@@ -402,3 +402,20 @@ struct HasField {
}
};
} // namespace LambdaCaptureReset
+
+// `used constexpr` methods are analyzed while their class is being defined.
+namespace GH236616 {
+template <class T> struct NoFields {
+ __attribute__((used)) constexpr int get() const { return 0; }
+};
+NoFields<int> no_fields;
+
+template <class T> struct WithField {
+ const int *p; // escape-note {{if field 'p' is owned by the class}}
+ __attribute__((used)) constexpr const int *get() const { // escape-warning
{{depends on the object referenced by field 'p'}}
+ return p; // escape-note {{returned here}}
----------------
NeKon69 wrote:
nit: align the comments here
https://github.com/llvm/llvm-project/pull/237022
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits