Skip to content

Commit 3dee9f9

Browse files
committed
C++: Fix another type error.
In `map.cpp` we had: ``` char *source(); ... std::unordered_map<const char *, std::pair<int, int>> m31; ... sink(m31.try_emplace("abc", source(), 2)); ``` which was incorrect because `source()` returns a `char*` and we're trying to stick it into a constructor for `std::pair<int, int>`.
1 parent 5f676c6 commit 3dee9f9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • cpp/ql/test/library-tests/dataflow/taint-tests

‎cpp/ql/test/library-tests/dataflow/taint-tests/map.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using namespace std;
55
namespace {
6-
char *source();
6+
char *source(); int source(int);
77
}
88
void sink(char *);
99
void sink(const char *);
@@ -413,10 +413,10 @@ void test_unordered_map()
413413
sink(m30.try_emplace(source(), 1, 2)); // $ MISSING: ast,ir
414414
sink(m30); // $ MISSING: ast,ir
415415
sink(m30["abc"]);
416-
sink(m31.try_emplace("abc", source(), 2)); // $ ast,ir
416+
sink(m31.try_emplace("abc", source(0), 2)); // $ ast,ir
417417
sink(m31); // $ ast,ir
418418
sink(m31["abc"]); // $ ast,ir
419-
sink(m32.try_emplace("abc", 1, source())); // $ ast,ir
419+
sink(m32.try_emplace("abc", 1, source(0))); // $ ast,ir
420420
sink(m32); // $ ast,ir
421421
sink(m32["abc"]); // $ ast,ir
422422

0 commit comments

Comments
 (0)