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

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 15 10:48:34 PDT 2019


zoecarver marked 2 inline comments as done.
zoecarver added inline comments.


================
Comment at: test/std/strings/basic.string.hash/char_type_hash.fail.cpp:20
+{
+    typedef CharT char_type;
+
----------------
mclow.lists wrote:
> 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`>.
Will do.


================
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> > >')}}
+
----------------
mclow.lists wrote:
> 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 {{*}}}}`
Good to know! That would also allow my first implementation to work where I created a function to hide all this in.


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