[clang-tools-extra] [clang-tidy] Fix bug in modernize-use-emplace (PR #66169)

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 17 10:50:31 PDT 2023


================
@@ -1332,6 +1337,17 @@ void testBracedInitTemporaries() {
   v3.push_back(NonTrivialWithCtor{{}});
   v3.push_back({{0}});
   v3.push_back({{}});
+
+  std::vector<NonTrivialWithIntAndVector> v4;
+
+  // These should not be noticed or fixed; after the correction, the code won't
+  // compile.
+  v4.push_back(NonTrivialWithIntAndVector{1, {}});
+  // CHECK-FIXES: v4.push_back(NonTrivialWithIntAndVector{1, {}});
+  v4.push_back(NonTrivialWithIntAndVector{});
+  // CHECK-FIXES: v4.push_back(NonTrivialWithIntAndVector{});
----------------
carlosgalvezp wrote:

We typically do not use `CHECK-FIXES` to ensure the code has not changed - the fact that a warning is not triggered should be enough (see rest of file).

https://github.com/llvm/llvm-project/pull/66169


More information about the cfe-commits mailing list