public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/19535] New: Wrong return types for __pair_get<1>
@ 2005-01-19 17:05 peturr02 at ru dot is
2005-01-19 17:07 ` [Bug libstdc++/19535] " peturr02 at ru dot is
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: peturr02 at ru dot is @ 2005-01-19 17:05 UTC (permalink / raw)
To: gcc-bugs
In tr1/utility:
template<>
struct __pair_get<1>
{
template<typename _Tp1, typename _Tp2>
static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
template<typename _Tp1, typename _Tp2>
static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
};
These functions should return (const) _Tp2&, since the type of __pair.second
is _Tp2.
--
Summary: Wrong return types for __pair_get<1>
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peturr02 at ru dot is
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19535
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/19535] Wrong return types for __pair_get<1>
2005-01-19 17:05 [Bug libstdc++/19535] New: Wrong return types for __pair_get<1> peturr02 at ru dot is
@ 2005-01-19 17:07 ` peturr02 at ru dot is
2005-01-20 2:14 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: peturr02 at ru dot is @ 2005-01-19 17:07 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2508 bytes --]
------- Additional Comments From peturr02 at ru dot is 2005-01-19 17:06 -------
Created an attachment (id=7993)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7993&action=view)
Test case
Compiling this fails with:
g++0116 -Wall -static 1.cc -o 1
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility: In function
typename std::tr1::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
std::tr1::get(std::pair<_Tp1, _Tp2>&) [with int _Int = 1, _Tp1 = A, _Tp2 = B]:
1.cc:9: instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility:80: error:
invalid initialization of reference of type B& from expression of type A
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility: In function
const typename std::tr1::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
std::tr1::get(const std::pair<_Tp1, _Tp2>&) [with int _Int = 1, _Tp1 = B, _Tp2
= A]:
1.cc:12: instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility:85: error:
invalid initialization of reference of type const A& from expression of type
const B
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility: In static
member function static _Tp1& std::tr1::__pair_get<1>::__get(std::pair<_T1,
_T2>&) [with _Tp1 = A, _Tp2 = B]:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility:80:
instantiated from typename std::tr1::tuple_element<_Int, std::pair<_Tp1, _Tp2>
>::type& std::tr1::get(std::pair<_Tp1, _Tp2>&) [with int _Int = 1, _Tp1 = A,
_Tp2 = B]
1.cc:9: instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility:70: error:
invalid initialization of reference of type A& from expression of type B
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility: In static
member function static const _Tp1& std::tr1::__pair_get<1>::__const_get(const
std::pair<_T1, _T2>&) [with _Tp1 = B, _Tp2 = A]:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility:85:
instantiated from const typename std::tr1::tuple_element<_Int, std::pair<_Tp1,
_Tp2> >::type& std::tr1::get(const std::pair<_Tp1, _Tp2>&) [with int _Int = 1,
_Tp1 = B, _Tp2 = A]
1.cc:12: instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/c++/tr1/utility:74: error:
invalid initialization of reference of type const B& from expression of type
const A
make: *** [1] Error 1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19535
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/19535] Wrong return types for __pair_get<1>
2005-01-19 17:05 [Bug libstdc++/19535] New: Wrong return types for __pair_get<1> peturr02 at ru dot is
2005-01-19 17:07 ` [Bug libstdc++/19535] " peturr02 at ru dot is
@ 2005-01-20 2:14 ` cvs-commit at gcc dot gnu dot org
2005-01-20 2:16 ` pcarlini at suse dot de
2005-01-25 6:20 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-20 2:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-01-20 02:14 -------
Subject: Bug 19535
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: paolo@gcc.gnu.org 2005-01-20 02:13:50
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/tr1: utility
Added files:
libstdc++-v3/testsuite/tr1/6_containers/utility: 19535.cc
Log message:
2005-01-19 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/19535
* include/tr1/utility (struct __pair_get<1>::__get, __const_get):
Fix typo in the return type.
* testsuite/tr1/6_containers/utility/19535.cc: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2862&r2=1.2863
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/tr1/utility.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/tr1/6_containers/utility/19535.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19535
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/19535] Wrong return types for __pair_get<1>
2005-01-19 17:05 [Bug libstdc++/19535] New: Wrong return types for __pair_get<1> peturr02 at ru dot is
2005-01-19 17:07 ` [Bug libstdc++/19535] " peturr02 at ru dot is
2005-01-20 2:14 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-20 2:16 ` pcarlini at suse dot de
2005-01-25 6:20 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2005-01-20 2:16 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
------- Additional Comments From pcarlini at suse dot de 2005-01-20 02:16 -------
Fixed, thanks Pétur.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19535
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/19535] Wrong return types for __pair_get<1>
2005-01-19 17:05 [Bug libstdc++/19535] New: Wrong return types for __pair_get<1> peturr02 at ru dot is
` (2 preceding siblings ...)
2005-01-20 2:16 ` pcarlini at suse dot de
@ 2005-01-25 6:20 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-25 6:20 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19535
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-25 6:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-19 17:05 [Bug libstdc++/19535] New: Wrong return types for __pair_get<1> peturr02 at ru dot is
2005-01-19 17:07 ` [Bug libstdc++/19535] " peturr02 at ru dot is
2005-01-20 2:14 ` cvs-commit at gcc dot gnu dot org
2005-01-20 2:16 ` pcarlini at suse dot de
2005-01-25 6:20 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).