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 2007/03/02 02:43:50 UTC

[jira] Commented: (STDCXX-236) std::reverse_iterator::iterator>::operator-> doesn't compile

    [ https://issues.apache.org/jira/browse/STDCXX-236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477159 ] 

Martin Sebor commented on STDCXX-236:
-------------------------------------

Still appears to be a problem even today, over 6 years later:

$ cat z.cpp && make z
#include <iterator>
#include <vector>

void main()
{
    std::reverse_iterator<std::vector<bool>::iterator>::operator->();
}
gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include  -pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   z.cpp
z.cpp:4: error: '::main' must return 'int'
z.cpp: In function 'int main()':
z.cpp:6: error: cannot call member function 'typename std::iterator_traits<_Iterator>::pointer std::reverse_iterator<_Iterator>::operator->() const [with _Iterator = std::vector<bool, std::allocator<bool> >::iterator]' without object
/build/sebor/dev/stdlib/include/rw/_iterator.h: In member function 'typename std::iterator_traits<_Iterator>::pointer std::reverse_iterator<_Iterator>::operator->() const [with _Iterator = std::vector<bool, std::allocator<bool> >::iterator]':
z.cpp:6:   instantiated from here
/build/sebor/dev/stdlib/include/rw/_iterator.h:151: warning: taking address of temporary
/build/sebor/dev/stdlib/include/rw/_iterator.h:151: error: cannot convert 'std::vector<bool, std::allocator<bool> >::reference*' to 'unsigned int*' in return
make: *** [z.o] Error 1


> std::reverse_iterator<std::vector<bool>::iterator>::operator-> doesn't compile
> ------------------------------------------------------------------------------
>
>                 Key: STDCXX-236
>                 URL: https://issues.apache.org/jira/browse/STDCXX-236
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 23. Containers
>         Environment: all
>            Reporter: Martin Sebor
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ Jun 23, 2000 04:08:36 PM****
> Subject: vector<bool> operator arrow cannot be explicitly instantiated (908)
> Date: Fri, 23 Jun 2000 16:06:09 -0400
> From: cxxrtl@cxxc.zko.dec.com
> To: OEMSUPPORT@roguewave.com
> /*
> This won't compile. It is from the Perennial test suite.
> cxx: Error: /usr/users/j_ward/BRUCE/include/iterator, line 559: expression
>           must be an lvalue or a function designator
>           detected during instantiation of
>                     "std::reverse_iterator<_Iterator>::pointer
>                     std::reverse_iterator<_Iterator>::operator->() const [with
>                     _Iterator=std::vector<bool,
>                     std::allocator<bool>>::iterator]" at line 7 of "t.cxx"
>     _RWSTD_OPERATOR_ARROW (pointer operator->() const);
> ----^
> */
> #include <iterator>
> #include <vector>
> void main()
> {
>           std::reverse_iterator<std::vector<bool>::iterator>::operator->;
> }
> ****Modified By: sebor @ May 09, 2002 12:00:25 PM****
> With SunPro 5.3 and the latest libstd 3.0:
> SUNWS_CACHE_NAME=t.ti CC -c -D_RWSTDDEBUG   -D_RWSTD_MULTI_THREAD -mt -D_RWSTD_POSIX_D10_THREADS -D_RWSTD_USE_CONFIG   -I/build/sebor/sunpro-15d/include -I/build2/sebor/dev/stdlib/include -I/build2/sebor/dev/stdlib/../rwtest -I/build2/sebor/dev/stdlib/../rwtest/include -I/build2/sebor/dev/stdlib/tests/include  -library=%none -g    +w  t.cpp 
> "/build2/sebor/dev/stdlib/include/rw/_iterator.h", line 153: Error: Cannot return std::vector<bool, std::allocator<bool>>::reference* from a function that should return unsigned*.
> 1 Error(s) detected.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.