incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (STDCXX-83) std::generate_n() assumes Size can be decremented
Date Thu, 08 Dec 2005 20:06:10 GMT
     [ http://issues.apache.org/jira/browse/STDCXX-83?page=all ]
     
Martin Sebor resolved STDCXX-83:
--------------------------------

    Resolution: Fixed

Fixed and test case added with the referenced changes.

> std::generate_n() assumes Size can be decremented
> -------------------------------------------------
>
>          Key: STDCXX-83
>          URL: http://issues.apache.org/jira/browse/STDCXX-83
>      Project: STDCXX
>         Type: Bug
>   Components: 25. Algorithms
>     Versions: 4.1.2
>  Environment: all
>     Reporter: Martin Sebor
>     Assignee: Martin Sebor
>     Priority: Minor
>      Fix For: 4.1.3

>
> The requirement on the Size template argument to std::generate_n() in lib.alg.generate,
p2 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::generate_n (int*, Size, 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/algorithm", line 431: error #349: no operator
>           "--" matches these operands
>             operand types are: -- Size
>       for (; __n > 0; --__n, ++__first)
>                       ^
>           detected during instantiation of "void std::generate_n(_OutputIter,
>                     _Size, _Generator) [with _OutputIter=int *, _Size=Size,
>                     _Generator=int (*)()]" at line 9 of "t.cpp"
> 1 error detected in the compilation of "t.cpp".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message