Com stdcxx userincubatorapacheorg stdcxx

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t on the Size template argument to std::fill_n() in lib.alg.fill, p3 is that it be convertible to an integral type which does not imply that it be possible to decrement or otherwise modify its value. I.e., the program below is expected to compile successfully. $ cat t.cpp && nice make t #include <algorithm> struct Size { operator int() { return 0; } private: void operator=(Size&); }; template void std::fill_n (int*, Size, const int&); int main () { } eccp -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/eccp-3.6-11s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include -I/build/sebor/dev/stdlib/tests/include -A -x --template_directory=/build/sebor/eccp-3.6-11s/lib -g --display_error_number --remarks --diag_suppress 193,236,340,401,261,479,487,678,679,815 t.cpp "/build/sebor/dev/stdlib/include/rw/_algobase.h", line 132: error #349: no operator "--" matches these operands operand types are: -- Size for (;__n > 0;--__n, ++__first) ^ detected during instantiation of "void std::fill_n(_OutputIter, _Size, const _TypeT &) [with _OutputIter=int *, _Size=Size, _TypeT=int]" at line 9 of "t.cpp" 1 error detected in the compilation of "t.cpp". make: *** [t.o] Error 2 std::istream::getline(buffer, 0) writes past the end of buffer The program below aborts on line 20 on all platforms indicating that std::istream::getline(buffer, 0) writes past the end of the zero-size buffer. $ cat -n t.cpp && nice gmake t -r && ./t 1 #include <cassert> 2 #include <sstream> 3 4 int main () 5 { 6 std::istringstream strm ("\n\n"); 7 8 char s [3] = { 'x', 'y', 'z' }; 9 10 strm.getline (s, 0); 11 12 // 27.6.1.3, p17, bullet 2: 13 // Characters are extracted and stored until c == delim for the next 14 // available input character c. 15 16 assert (strm.goodbit == strm.rdstate ()); 17 assert (1 == strm.gcount ()); 18 assert ('x' == s [0]); 19 assert ('y' == s [1]); 20 a...
View Full Document

This document was uploaded on 10/12/2012.

Ask a homework question - tutors are online