This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/53941] New: "Range-based for" feature is not implemented for std::pair<>.


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53941

             Bug #: 53941
           Summary: "Range-based for" feature is not implemented for
                    std::pair<>.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: maxim.yegorushkin@gmail.com


gcc-4.7.1 seems to be missing std::begin() and std::end() overloads for
std::pair<> class template as required by
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html 


[max@otlonlin050:~/src/test] $ cat test.cc
#include <utility>
#include <iterator>
#include <iostream>

int main() {
    char const arr[] = "abc";
    std::pair<char const*, char const*> range(
          std::begin(arr)
        , std::end(arr)
        );
    for(char c : range)
        std::cout << c << '\n';
}

[max@otlonlin050:~/src/test] $ g++ -v -o test -std=gnu++11 -Wall -Wextra -g
-march=native -fmessage-length=0 test.cc
Using built-in specs.
COLLECT_GCC=/usr/local/ots/gcc/bin/g++47
COLLECT_LTO_WRAPPER=/usr/local/ots/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.7.1-src/configure --prefix=/usr/local/ots/gcc
--program-suffix=47 --disable-libunwind-exceptions --with-system-zlib
--enable-__cxa_atexit --enable-checking=release --disable-multilib
--with-gmp-include=/usr/local/ots/gcc/include
--with-mpfr-include=/usr/local/ots/gcc/include
--with-mpc-include=/usr/local/ots/gcc/include
--with-ppl-include=/usr/local/ots/gcc/include
--with-cloog-include=/usr/local/ots/gcc/include
--with-binutils-include=/usr/local/ots/gcc/include
--with-gmp-lib=/usr/local/ots/gcc/lib64
--with-mpfr-lib=/usr/local/ots/gcc/lib64
--with-mpc-lib=/usr/local/ots/gcc/lib64 --with-ppl-lib=/usr/local/ots/gcc/lib64
--with-cloog-lib=/usr/local/ots/gcc/lib64
--with-binutils-lib=/usr/local/ots/gcc/lib64
--enable-languages=c,c++,fortran,lto --enable-plugin --enable-initfini-array
--enable-gold=default
Thread model: posix
gcc version 4.7.1 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-o' 'test' '-std=gnu++11' '-Wall' '-Wextra' '-g'
'-march=native' '-fmessage-length=0' '-shared-libgcc'
 /usr/local/ots/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/cc1plus -quiet
-v -D_GNU_SOURCE test.cc -march=corei7 -mcx16 -msahf -mno-movbe -mno-aes
-mno-pclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi
-mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rdrnd
-mno-f16c -mno-fsgsbase --param l1-cache-size=32 --param l1-cache-line-size=64
--param l2-cache-size=8192 -mtune=corei7 -quiet -dumpbase test.cc -auxbase test
-g -Wall -Wextra -std=gnu++11 -version -fmessage-length=0 -o /tmp/cc3Kix8x.s
GNU C++ (GCC) version 4.7.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 2.4.2, MPC
version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1

/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/x86_64-unknown-linux-gnu

/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/backward
 /usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include
 /usr/local/include
 /usr/local/ots/gcc/include
 /usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.7.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 2.4.2, MPC
version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 509ff8363214570b3e6eef60c53bc426
test.cc: In function âint main()â:
test.cc:11:18: error: no matching function for call to âbegin(std::pair<const
char*, const char*>&)â
test.cc:11:18: note: candidates are:
In file included from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/string:53:0,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/locale_classes.h:42,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/ios_base.h:43,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ios:43,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ostream:40,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/iterator:64,
                 from test.cc:2:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:87:5:
note: template<class _Tp, long unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm])
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:87:5:
note:   template argument deduction/substitution failed:
test.cc:11:18: note:   mismatched types â_Tp [_Nm]â and âstd::pair<const char*,
const char*>â
In file included from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/string:53:0,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/locale_classes.h:42,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/ios_base.h:43,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ios:43,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ostream:40,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/iterator:64,
                 from test.cc:2:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:58:5:
note: template<class _Container> decltype (__cont.begin()) std::begin(const
_Container&)
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:58:5:
note:   template argument deduction/substitution failed:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:
In substitution of âtemplate<class _Container> decltype (__cont.begin())
std::begin(const _Container&) [with _Container = std::pair<const char*, const
char*>]â:
test.cc:11:18:   required from here
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:58:5:
error: âconst struct std::pair<const char*, const char*>â has no member named
âbeginâ
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:48:5:
note: template<class _Container> decltype (__cont.begin())
std::begin(_Container&)
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:48:5:
note:   template argument deduction/substitution failed:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:
In substitution of âtemplate<class _Container> decltype (__cont.begin())
std::begin(_Container&) [with _Container = std::pair<const char*, const
char*>]â:
test.cc:11:18:   required from here
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:48:5:
error: âstruct std::pair<const char*, const char*>â has no member named âbeginâ
In file included from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/utility:76:0,
                 from test.cc:1:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/initializer_list:89:5:
note: template<class _Tp> constexpr const _Tp*
std::begin(std::initializer_list<_Tp>)
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/initializer_list:89:5:
note:   template argument deduction/substitution failed:
test.cc:11:18: note:   âstd::pair<const char*, const char*>â is not derived
from âstd::initializer_list<_Tp>â
test.cc:11:18: error: no matching function for call to âend(std::pair<const
char*, const char*>&)â
test.cc:11:18: note: candidates are:
In file included from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/string:53:0,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/locale_classes.h:42,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/ios_base.h:43,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ios:43,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ostream:40,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/iterator:64,
                 from test.cc:2:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:97:5:
note: template<class _Tp, long unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm])
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:97:5:
note:   template argument deduction/substitution failed:
test.cc:11:18: note:   mismatched types â_Tp [_Nm]â and âstd::pair<const char*,
const char*>â
In file included from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/string:53:0,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/locale_classes.h:42,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/ios_base.h:43,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ios:43,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ostream:40,
                 from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/iterator:64,
                 from test.cc:2:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:78:5:
note: template<class _Container> decltype (__cont.end()) std::end(const
_Container&)
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:78:5:
note:   template argument deduction/substitution failed:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:
In substitution of âtemplate<class _Container> decltype (__cont.end())
std::end(const _Container&) [with _Container = std::pair<const char*, const
char*>]â:
test.cc:11:18:   required from here
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:78:5:
error: âconst struct std::pair<const char*, const char*>â has no member named
âendâ
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:68:5:
note: template<class _Container> decltype (__cont.end()) std::end(_Container&)
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:68:5:
note:   template argument deduction/substitution failed:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:
In substitution of âtemplate<class _Container> decltype (__cont.end())
std::end(_Container&) [with _Container = std::pair<const char*, const char*>]â:
test.cc:11:18:   required from here
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/range_access.h:68:5:
error: âstruct std::pair<const char*, const char*>â has no member named âendâ
In file included from
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/utility:76:0,
                 from test.cc:1:
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/initializer_list:99:5:
note: template<class _Tp> constexpr const _Tp*
std::end(std::initializer_list<_Tp>)
/usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/initializer_list:99:5:
note:   template argument deduction/substitution failed:
test.cc:11:18: note:   âstd::pair<const char*, const char*>â is not derived
from âstd::initializer_list<_Tp>â


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]