[libcxx-commits] [PATCH] D61954: Ensure that hash<basic_string> uses char_traits (41876)

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 15 10:38:29 PDT 2019


mclow.lists added a comment.

Other than the skimpy `traits` implementation, this looks good to me.



================
Comment at: test/std/strings/basic.string.hash/char_type_hash.fail.cpp:20
+{
+    typedef CharT char_type;
+
----------------
You should put a full traits implementation in here; just to be sure that some other failure isn't masking the one that you want. Just copy the default one from `<__string`>.


================
Comment at: test/std/strings/basic.string.hash/char_type_hash.fail.cpp:29
+    typedef std::basic_string<char, evil_trait<char>> evil_char_string;
+    std::hash<evil_char_string> h1; // expected-error {{call to implicitly-deleted default constructor of 'std::hash<evil_char_string>' (aka 'hash<basic_string<char, evil_trait<char> > >')}}
+
----------------
You can use `expected-error-re` to avoid having to spell out the entire error message.
Something like this:
`// expected-error-re {{call to implicitly-deleted default constructor of 'std::hash<evil_char_string>' aka {{*}}}}`


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61954/new/

https://reviews.llvm.org/D61954





More information about the libcxx-commits mailing list