parent
769b20b426
commit
39f9bc7422
|
@ -7204,7 +7204,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
|
|||
<!-- template<class InputIterator> typename iterator_traits<InputIterator>::difference_type std::distance (InputIterator first, InputIterator last); -->
|
||||
<function name="std::distance">
|
||||
<use-retval/>
|
||||
<returnValue type="std::ssize_t"/>
|
||||
<returnValue type="std::ptrdiff_t"/>
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1" direction="in">
|
||||
<not-uninit/>
|
||||
|
|
|
@ -74,6 +74,7 @@ private:
|
|||
TEST_CASE(testPrintfTypeAlias1);
|
||||
TEST_CASE(testPrintfAuto); // #8992
|
||||
TEST_CASE(testPrintfParenthesis); // #8489
|
||||
TEST_CASE(testStdDistance); // #10304
|
||||
}
|
||||
|
||||
void check(const char* code, bool inconclusive = false, bool portability = false, Settings::PlatformType platform = Settings::Unspecified, bool onlyFormatStr = false) {
|
||||
|
@ -4819,6 +4820,14 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) %f in format string (no. 1) requires 'double' but the argument type is 'signed int'.\n", errout.str());
|
||||
}
|
||||
|
||||
void testStdDistance() { // #10304
|
||||
check("void foo(const std::vector<int>& IO, const int* pio) {\n"
|
||||
"const auto Idx = std::distance(&IO.front(), pio);\n"
|
||||
"printf(\"Idx = %td\", Idx);\n"
|
||||
"}", /*inconclusive*/ false, /*portability*/ true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestIO)
|
||||
|
|
Loading…
Reference in New Issue