File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -59,3 +59,22 @@ Options
5959 types that don't own the underlying data. Like for `AllowedTypes ` above,
6060 regular expressions are accepted and the inclusion of `:: ` determines whether
6161 the qualified typename is matched or not.
62+
63+
64+ Limitations
65+ -----------
66+
67+ This check does not perform lifetime analysis and may suggest replacing copies
68+ with const references that could become dangling. Be cautious when the
69+ referenced object might be invalidated by subsequent operations.
70+
71+ .. code-block :: c++
72+
73+ void consume(const S&);
74+
75+ void func(std::vector<S> &Vec) {
76+ const auto It = Vec.begin();
77+ const S Value(*It); // The warning will suggest making this a const reference.
78+ Vec.erase(It); // Container modifications could invalidate references.
79+ consume(Value); // Safe with copy, dangling reference otherwise.
80+ }
You can’t perform that action at this time.
0 commit comments