File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -666,6 +666,15 @@ Improvements to Clang's diagnostics
666
666
bool operator==(const C&) = default;
667
667
};
668
668
669
+ - Clang now emits `-Wdangling-capture ` diangostic when a STL container captures a dangling reference.
670
+
671
+ .. code-block :: c++
672
+
673
+ void test() {
674
+ std::vector<std::string_view> views;
675
+ views.push_back(std::string("123")); // warning
676
+ }
677
+
669
678
Improvements to Clang's time-trace
670
679
----------------------------------
671
680
Original file line number Diff line number Diff line change @@ -10237,10 +10237,10 @@ def warn_dangling_pointer_assignment : Warning<
10237
10237
InGroup<DanglingAssignment>;
10238
10238
def warn_dangling_reference_captured : Warning<
10239
10239
"object whose reference is captured by '%0' will be destroyed at the end of "
10240
- "the full-expression">, InGroup<DanglingCapture>, DefaultIgnore ;
10240
+ "the full-expression">, InGroup<DanglingCapture>;
10241
10241
def warn_dangling_reference_captured_by_unknown : Warning<
10242
10242
"object whose reference is captured will be destroyed at the end of "
10243
- "the full-expression">, InGroup<DanglingCapture>, DefaultIgnore ;
10243
+ "the full-expression">, InGroup<DanglingCapture>;
10244
10244
10245
10245
// For non-floating point, expressions of the form x == x or x != x
10246
10246
// should result in a warning, since these always evaluate to a constant.
You can’t perform that action at this time.
0 commit comments