You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2005/12/07 22:57:08 UTC

[jira] Created: (STDCXX-84) std::fill_n() assumes Size can be decremented

std::fill_n() assumes Size can be decremented
---------------------------------------------

         Key: STDCXX-84
         URL: http://issues.apache.org/jira/browse/STDCXX-84
     Project: STDCXX
        Type: Bug
  Components: 25. Algorithms  
    Versions: 4.1.2    
 Environment: all
    Reporter: Martin Sebor
 Assigned to: Martin Sebor 
    Priority: Minor
     Fix For: 4.1.3


The requirement 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


-- 
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


[jira] Resolved: (STDCXX-84) std::fill_n() assumes Size can be decremented

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/STDCXX-84?page=all ]
     
Martin Sebor resolved STDCXX-84:
--------------------------------

    Resolution: Fixed

Resolved. Will close when a test has been added to the test suite.

> std::fill_n() assumes Size can be decremented
> ---------------------------------------------
>
>          Key: STDCXX-84
>          URL: http://issues.apache.org/jira/browse/STDCXX-84
>      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::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

-- 
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


[jira] Closed: (STDCXX-84) std::fill_n() assumes Size can be decremented

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/STDCXX-84?page=all ]
     
Martin Sebor closed STDCXX-84:
------------------------------


Test 25.fill.cpp enhanced with the following change:
http://svn.apache.org/viewcvs.cgi?rev=357264&view=rev

Closing.

> std::fill_n() assumes Size can be decremented
> ---------------------------------------------
>
>          Key: STDCXX-84
>          URL: http://issues.apache.org/jira/browse/STDCXX-84
>      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::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

-- 
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