public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: pme@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	martin.rieger@mmr2.sianum.de, nobody@gcc.gnu.org,
	pme@gcc.gnu.org
Subject: Re: c++/3795: The "bitset" template from the STL doesn't work properly
Date: Tue, 24 Jul 2001 12:05:00 -0000	[thread overview]
Message-ID: <20010724190533.31668.qmail@sourceware.cygnus.com> (raw)

Synopsis: The "bitset" template from the STL doesn't work properly

Responsible-Changed-From-To: unassigned->pme
Responsible-Changed-By: pme
Responsible-Changed-When: Tue Jul 24 12:05:33 2001
Responsible-Changed-Why:
    Priority changed to low because there is a workaround.
State-Changed-From-To: open->analyzed
State-Changed-By: pme
State-Changed-When: Tue Jul 24 12:05:33 2001
State-Changed-Why:
    Thank you for your bug report.
    
    As far as (1) goes, this is not a bug.  In fact,
    this has already been reported to the ISO C++
    committee with the note, "...the user cannot
    pass this template constructor a const char* and
    expect a conversion to basic_string.  The reason
    is "When you have a template constructor, it can
    get used in contexts where type deduction can
    be done. Type deduction basically comes up with
    exact matches, not ones involving conversions.""
    
    The LWG's response is, "Although the problem
    is real, the standard is designed that way
    so it is not a defect.  Education is the
    immediate workaround. A future standard may
    wish to consider the Proposed Resolution as
    an extension."  The proposed resolution was to
    add another constructor taking a const char*.
    
    
    Okay, problem (2)... yeah, that does seem kinda
    stupid, but I can understand the reasoning.
    (This may not even be a defect in the standard,
    in which case one of the people on the LWG can
    close this PR.)  The tricky part is that string
    is a templated type, and bitset<> doesn't know
    what parameters to use when instantiating the
    string returned from to_string().  You need
    to write
    
    bs.to_string<char,char_traits<char>,allocator<char> >()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    to instantiate the member template function.
    Although I would argue that the signature
    preceeding [23.3.5.2]/33 should allow the second
    and third template arguments to have default
    values, like basic_string<char> does, so that
    
    bs.to_string<char>()
    
    could work.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3795&database=gcc


             reply	other threads:[~2001-07-24 12:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-24 12:05 pme [this message]
2001-07-25 13:45 pme

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010724190533.31668.qmail@sourceware.cygnus.com \
    --to=pme@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=martin.rieger@mmr2.sianum.de \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).