[all-commits] [llvm/llvm-project] 157f34: [libc++] Fixes basic_string operator& hijacking.

Mark de Wever via All-commits all-commits at lists.llvm.org
Tue Mar 7 10:04:10 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 157f34af7157686e6dcae631573034046340953d
      https://github.com/llvm/llvm-project/commit/157f34af7157686e6dcae631573034046340953d
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M libcxx/include/string
    M libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp
    M libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
    A libcxx/test/support/nasty_string.h

  Log Message:
  -----------
  [libc++] Fixes basic_string operator& hijacking.

Avoids using operator& in basic_string since an evil char-like type can
hijack this operator. Added some more evil operators, this found a place
where equality was compared directly and not via the traits.

This adds a helper test string. This is now only used in a few tests,
but the intention is to use this in more tests for basic_string.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D145257




More information about the All-commits mailing list