[libcxx-commits] [libcxx] f9ed86a - [libc++][NFC] Avoid most-vexing parse

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 1 19:26:35 PST 2022


Author: Louis Dionne
Date: 2022-12-01T19:26:17-08:00
New Revision: f9ed86a5fd952864da44c1f51b978e467fc4cdc6

URL: https://github.com/llvm/llvm-project/commit/f9ed86a5fd952864da44c1f51b978e467fc4cdc6
DIFF: https://github.com/llvm/llvm-project/commit/f9ed86a5fd952864da44c1f51b978e467fc4cdc6.diff

LOG: [libc++][NFC] Avoid most-vexing parse

Added: 
    

Modified: 
    libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
index d62067cf13a5c..917bb0fa38d01 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
@@ -126,14 +126,14 @@ TEST_CONSTEXPR_CXX20 bool test_alloc() {
     using string = std::basic_string<char, std::char_traits<char>, alloc>;
     test_allocator_statistics stats;
     {
-      string str((alloc(&stats)));
+      string str = string(alloc(&stats));
       stats = test_allocator_statistics();
       (void)str.substr();
       assert(stats.moved == 0);
       assert(stats.copied == 0);
     }
     {
-      string str((alloc(&stats)));
+      string str = string(alloc(&stats));
       stats = test_allocator_statistics();
       (void)std::move(str).substr();
       assert(stats.moved == 0);


        


More information about the libcxx-commits mailing list