aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-09-11 10:10:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-09-11 10:10:09 +0000
commit75cd5ac847bb64526957bd880d360b6102d96452 (patch)
tree1a676b0da3ba3d07f18066c851e304260f256ae4
parente0095a7644863a8d37ebc2306549cb4e92ecd3aa (diff)
downloadsrc-75cd5ac847bb64526957bd880d360b6102d96452.tar.gz
src-75cd5ac847bb64526957bd880d360b6102d96452.zip
Notes
Notes: svn path=/vendor/libc++/dist-release_70/; revision=338581 svn path=/vendor/libc++/libc++-release_70-r348011/; revision=341370; tag=vendor/libc++/libc++-release_70-r348011
-rw-r--r--include/memory6
-rw-r--r--include/regex15
-rw-r--r--test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp44
-rw-r--r--test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp2
-rw-r--r--test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp8
-rw-r--r--test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp7
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp8
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp9
8 files changed, 86 insertions, 13 deletions
diff --git a/include/memory b/include/memory
index a4bf89b495ad..adfe4f4fbbed 100644
--- a/include/memory
+++ b/include/memory
@@ -1989,10 +1989,10 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
- {::new(&*__x_) _Tp(__element); return *this;}
+ {::new(_VSTD::addressof(*__x_)) _Tp(__element); return *this;}
#if _LIBCPP_STD_VER >= 14
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
- {::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
+ {::new(_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;}
#endif
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int)
@@ -3682,7 +3682,7 @@ private:
virtual void __on_zero_shared_weak() _NOEXCEPT;
public:
_LIBCPP_INLINE_VISIBILITY
- _Tp* get() _NOEXCEPT {return &__data_.second();}
+ _Tp* get() _NOEXCEPT {return _VSTD::addressof(__data_.second());}
};
template <class _Tp, class _Alloc>
diff --git a/include/regex b/include/regex
index 84aacc029edc..dcdb14af9afb 100644
--- a/include/regex
+++ b/include/regex
@@ -2414,20 +2414,17 @@ __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
goto __exit;
}
}
- // set of "__found" chars =
+ // When there's at least one of __neg_chars_ and __neg_mask_, the set
+ // of "__found" chars is
// union(complement(union(__neg_chars_, __neg_mask_)),
// other cases...)
//
- // __neg_chars_ and __neg_mask_'d better be handled together, as there
- // are no short circuit opportunities.
- //
- // In addition, when __neg_mask_/__neg_chars_ is empty, they should be
- // treated as all ones/all chars.
+ // It doesn't make sense to check this when there are no __neg_chars_
+ // and no __neg_mask_.
+ if (!(__neg_mask_ == 0 && __neg_chars_.empty()))
{
- const bool __in_neg_mask = (__neg_mask_ == 0) ||
- __traits_.isctype(__ch, __neg_mask_);
+ const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
const bool __in_neg_chars =
- __neg_chars_.empty() ||
std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
__neg_chars_.end();
if (!(__in_neg_mask || __in_neg_chars))
diff --git a/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp b/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp
new file mode 100644
index 000000000000..5a19edc1a4d6
--- /dev/null
+++ b/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+// UNSUPPORTED: c++98, c++03
+
+// Make sure that we correctly match inverted character classes.
+
+#include <cassert>
+#include <regex>
+
+
+int main() {
+ assert(std::regex_match("X", std::regex("[X]")));
+ assert(std::regex_match("X", std::regex("[XY]")));
+ assert(!std::regex_match("X", std::regex("[^X]")));
+ assert(!std::regex_match("X", std::regex("[^XY]")));
+
+ assert(std::regex_match("X", std::regex("[\\S]")));
+ assert(!std::regex_match("X", std::regex("[^\\S]")));
+
+ assert(!std::regex_match("X", std::regex("[\\s]")));
+ assert(std::regex_match("X", std::regex("[^\\s]")));
+
+ assert(std::regex_match("X", std::regex("[\\s\\S]")));
+ assert(std::regex_match("X", std::regex("[^Y\\s]")));
+ assert(!std::regex_match("X", std::regex("[^X\\s]")));
+
+ assert(std::regex_match("X", std::regex("[\\w]")));
+ assert(std::regex_match("_", std::regex("[\\w]")));
+ assert(!std::regex_match("X", std::regex("[^\\w]")));
+ assert(!std::regex_match("_", std::regex("[^\\w]")));
+
+ assert(!std::regex_match("X", std::regex("[\\W]")));
+ assert(!std::regex_match("_", std::regex("[\\W]")));
+ assert(std::regex_match("X", std::regex("[^\\W]")));
+ assert(std::regex_match("_", std::regex("[^\\W]")));
+}
diff --git a/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp b/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
index dd17d3519e3e..dc0b98558048 100644
--- a/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
@@ -18,7 +18,7 @@
#include <regex>
#include <cassert>
-#include "test_macros.h"
+
// PR34310
int main()
diff --git a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
index 62a3be80d8b6..eb66ed4ad47b 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
@@ -15,6 +15,13 @@
#include "test_macros.h"
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
+
int A_constructed = 0;
struct A
@@ -27,6 +34,7 @@ public:
~A() {--A_constructed; data_ = 0;}
bool operator==(int i) const {return data_ == i;}
+ A* operator& () DELETE_FUNCTION;
};
int main()
diff --git a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
index 3df8dd0eded0..4d9d698f7420 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
@@ -16,6 +16,12 @@
#include "test_macros.h"
#include <MoveOnly.h>
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
int A_constructed = 0;
struct A
@@ -28,6 +34,7 @@ public:
~A() {--A_constructed; data_ = 0;}
bool operator==(int i) const {return data_ == i;}
+ A* operator& () DELETE_FUNCTION;
};
int main()
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
index 3e4a99e981d4..a430b5d796e2 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
@@ -23,6 +23,12 @@
#include "test_allocator.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
int new_count = 0;
struct A
@@ -37,6 +43,8 @@ struct A
int get_int() const {return int_;}
char get_char() const {return char_;}
+
+ A* operator& () DELETE_FUNCTION;
private:
int int_;
char char_;
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
index f8f73f771356..88e6919526f9 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
@@ -19,6 +19,12 @@
#include "test_macros.h"
#include "count_new.hpp"
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
struct A
{
static int count;
@@ -31,6 +37,9 @@ struct A
int get_int() const {return int_;}
char get_char() const {return char_;}
+
+ A* operator& () DELETE_FUNCTION;
+
private:
int int_;
char char_;