[libcxx-commits] [PATCH] D95975: [libc++] Remove the ability to use braced-init for filesystem paths

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 3 13:44:56 PST 2021


ldionne created this revision.
ldionne added a reviewer: mstorsjo.
Herald added a subscriber: jkorous.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

According to my reading of http://eel.is/c++draft/filesystems#fs.class.path,
the Standard doesn't actually mention that this should work. Since other
implementations don't allow it, allowing it in libc++ is just setting a
portability trap.

Supersedes https://reviews.llvm.org/D89865.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95975

Files:
  libcxx/include/filesystem
  libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/braced_init.pass.cpp


Index: libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/braced_init.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/braced_init.pass.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03
-
-// <filesystem>
-
-// class path
-
-// path& operator=(path const&);
-
-#include "filesystem_include.h"
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-#include "count_new.h"
-
-
-int main(int, char**) {
-  using namespace fs;
-  path p("abc");
-  p = {};
-#ifdef _WIN32
-  assert(p.native() == L"");
-#else
-  assert(p.native() == "");
-#endif
-
-  return 0;
-}
Index: libcxx/include/filesystem
===================================================================
--- libcxx/include/filesystem
+++ libcxx/include/filesystem
@@ -973,8 +973,8 @@
     return *this;
   }
 
-  template <class = void>
-  _LIBCPP_INLINE_VISIBILITY path& operator=(string_type&& __s) noexcept {
+  _LIBCPP_INLINE_VISIBILITY
+  path& operator=(string_type&& __s) noexcept {
     __pn_ = _VSTD::move(__s);
     return *this;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95975.321218.patch
Type: text/x-patch
Size: 1538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210203/8c6a380b/attachment.bin>


More information about the libcxx-commits mailing list