diff --git a/infer/src/concurrency/RacerD.ml b/infer/src/concurrency/RacerD.ml index b2679a810..5602d562a 100644 --- a/infer/src/concurrency/RacerD.ml +++ b/infer/src/concurrency/RacerD.ml @@ -1524,10 +1524,11 @@ module SyntacticQuotientedAccessListMap : QuotientedAccessListMap = struct let compare (x: t) (y: t) = match (x, y) with - | ( (Read ap1 | Write ap1 | ContainerRead (ap1, _) | ContainerWrite (ap1, _)) - , (Read ap2 | Write ap2 | ContainerRead (ap2, _) | ContainerWrite (ap2, _)) ) -> + | (Read ap1 | Write ap1), (Read ap2 | Write ap2) + | ( (ContainerRead (ap1, _) | ContainerWrite (ap1, _)) + , (ContainerRead (ap2, _) | ContainerWrite (ap2, _)) ) -> [%compare : (_var * Typ.t) * AccessPath.access list] ap1 ap2 - | InterfaceCall _, _ | _, InterfaceCall _ -> + | (InterfaceCall _ | Read _ | Write _ | ContainerRead _ | ContainerWrite _), _ -> RacerDDomain.Access.compare x y end) diff --git a/infer/tests/codetoanalyze/cpp/racerd/containers.cpp b/infer/tests/codetoanalyze/cpp/racerd/containers.cpp new file mode 100644 index 000000000..07cd11295 --- /dev/null +++ b/infer/tests/codetoanalyze/cpp/racerd/containers.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#include +#include + +namespace containers { + +struct A { + int value; +}; + +struct B { + + void access_container_and_contents_ok(int key, int value) { + int s = map.size(); + mutex_.lock(); + map[key].value = value; + } + + private: + std::map map; + std::mutex mutex_; +}; +} // namespace containers