Your message dated Sat, 16 Nov 2002 13:50:55 +0100
with message-id <[EMAIL PROTECTED]>
and subject line Bug#144409: g++-3.0: does not support transform(begin,end,be
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 24 Apr 2002 19:36:09 +0000
>From [EMAIL PROTECTED] Wed Apr 24 14:36:09 2002
Return-path: <[EMAIL PROTECTED]>
Received: from rwcrmhc51.attbi.com [204.127.198.38] 
        by master.debian.org with esmtp (Exim 3.12 1 (Debian))
        id 170SYj-0002li-00; Wed, 24 Apr 2002 14:36:09 -0500
Received: from one ([12.235.84.58]) by rwcrmhc51.attbi.com
          (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP
          id <[EMAIL PROTECTED]>;
          Wed, 24 Apr 2002 19:35:38 +0000
Received: from shaleh by one with local (Exim 3.35 #1 (Debian))
        id 170SYE-0003PE-00; Wed, 24 Apr 2002 12:35:38 -0700
From: Sean Perry <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: g++-3.0: does not support transform(begin,end,begin,tolower) idiom
X-Mailer: reportbug 1.50
Date: Wed, 24 Apr 2002 12:35:38 -0700
Message-Id: <[EMAIL PROTECTED]>
Sender: Sean Perry <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]

Package: g++-3.0
Version: 1:3.0.4-7
Severity: normal

the code below is from Josuttis' "The C++ standard library" and I have seen it
elsewhere.  It works under 2.95.4.

#include <string>
#include <algorithm>
#include <cctype>
#include <iostream>
using namespace std;

int main(int argc, char* argv[]) {
    string foo = "Some Mixed Case Text";
    cout << foo << endl;
    transform(foo.begin(), foo.end(), foo.begin(), tolower);
    cout << foo << endl;

    exit(0);
}

The problem seems to be the second use of foo.begin().

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux one 2.4.18 #1 Sat Mar 9 08:43:28 PST 2002 i686
Locale: LANG=C, LC_CTYPE=en_US

Versions of packages g++-3.0 depends on:
ii  gcc-3.0                       1:3.0.4-7  The GNU C compiler.
ii  gcc-3.0-base                  1:3.0.4-7  The GNU Compiler Collection (base 
ii  libc6                         2.2.5-4    GNU C Library: Shared libraries an
ii  libstdc++3-dev                1:3.0.4-7  The GNU stdc++ library version 3 (


---------------------------------------
Received: (at 144409-done) by bugs.debian.org; 16 Nov 2002 12:54:58 +0000
>From [EMAIL PROTECTED] Sat Nov 16 06:54:36 2002
Return-path: <[EMAIL PROTECTED]>
Received: from mail.cs.tu-berlin.de [130.149.17.13] (root)
        by master.debian.org with esmtp (Exim 3.12 1 (Debian))
        id 18D2T2-0002Jf-00; Sat, 16 Nov 2002 06:54:33 -0600
Received: from bolero.cs.tu-berlin.de ([EMAIL PROTECTED] [130.149.19.1])
        by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id NAA24020;
        Sat, 16 Nov 2002 13:50:56 +0100 (MET)
Received: (from [EMAIL PROTECTED])
        by bolero.cs.tu-berlin.de (8.11.6+Sun/8.9.3) id gAGCotf05386;
        Sat, 16 Nov 2002 13:50:55 +0100 (MET)
From: Matthias Klose <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <[EMAIL PROTECTED]>
Date: Sat, 16 Nov 2002 13:50:55 +0100
To: "Sean 'Shaleh' Perry" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Subject: Re: Bug#144409: g++-3.0: does not support transform(begin,end,be
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid
Delivered-To: [EMAIL PROTECTED]
X-Spam-Status: No, hits=-8.7 required=5.0
        tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_03_05
        version=2.41
X-Spam-Level: 

Closing the report with Martin's explanation.

Sean 'Shaleh' Perry writes:
> >> int main(int argc, char* argv[]) {
> >>     string foo = "Some Mixed Case Text";
> >>     cout << foo << endl;
> >>     transform(foo.begin(), foo.end(), foo.begin(), tolower);
> > 
> > The compiler can't properly resolve "tolower": The problem is that
> > tolower is not only a function in namespace std, it is also a template
> > (22.1.3/2). Therefore, in the call to transform, template argument
> > deduction fails because of the ambiguity.
> > 
> > You can fix your code in the following ways:
> > 1. Define a wrapper function around tolower that you pass to
> >    transform.
> > 2. Explicitly select the tolower you want to use, by writing
> > 
> >     transform(foo.begin(), foo.end(), foo.begin(),
> > (int(*)(int))std::tolower);
> > 
> >    The cast causes, on the one hand, an explicit overload resolution
> >    in favour of the function; it also allows the compiler to properly
> >    deduce the third argument to transform.
> > 
> 
> man, neither option is particularly pretty, but the cast does let the code
> compile.
> 
> I suppose I can define my own tolower() function based on the library's
> version rather than use a wrapper.
> 
> Thanks for helping Martin.  It is disappointing that the above code breaks.


Reply via email to