public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/61374] New: string_view::operator string() is buggy
@ 2014-05-31  2:21 john.salmon at deshaw dot com
  2014-05-31 10:54 ` [Bug libstdc++/61374] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: john.salmon at deshaw dot com @ 2014-05-31  2:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61374

            Bug ID: 61374
           Summary: string_view::operator string() is buggy
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: john.salmon at deshaw dot com

The problem is the string(length, c) constructor on line 255 of string_view. 
The begin/end constructor is what's needed.  Here's a quick demonstration.

drdlogin0039$ cat bug.cpp
#include <experimental/string_view>
#include <string>

std::experimental::string_view sv("hello world");
std::string s {sv};
drdlogin0039$
drdlogin0039$
drdlogin0039$ dw -m gcc/4.9.0-28B/bin g++ -std=c++1y bug.cpp 
In file included from bug.cpp:1:0:
/aprj/desrad-c/root/Linux/x86_64/gcc/4.9.0-28B/include/c++/4.9.0/experimental/string_view:
In instantiation of 'std::experimental::basic_string_view<_CharT,
_Traits>::operator std::basic_string<_CharT, _Traits, _Allocator>() const [with
_Allocator = std::allocator<char>; _CharT = char; _Traits =
std::char_traits<char>]':
bug.cpp:5:18:   required from here
/aprj/desrad-c/root/Linux/x86_64/gcc/4.9.0-28B/include/c++/4.9.0/experimental/string_view:255:33:
error: invalid conversion from 'const char*' to 'char' [-fpermissive]
      (this->_M_len, this->_M_str);
                                 ^
In file included from
/aprj/desrad-c/root/Linux/x86_64/gcc/4.9.0-28B/include/c++/4.9.0/string:52:0,
                 from
/aprj/desrad-c/root/Linux/x86_64/gcc/4.9.0-28B/include/c++/4.9.0/experimental/string_view:43,
                 from bug.cpp:1:
/aprj/desrad-c/root/Linux/x86_64/gcc/4.9.0-28B/include/c++/4.9.0/bits/basic_string.h:502:7:
note: initializing argument 2 of 'std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(std::basic_string<_CharT, _Traits, _Alloc>::size_type,
_CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>;
_Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits,
_Alloc>::size_type = long unsigned int]'
       basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());
       ^
drdlogin0039$


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61374] string_view::operator string() is buggy
  2014-05-31  2:21 [Bug libstdc++/61374] New: string_view::operator string() is buggy john.salmon at deshaw dot com
@ 2014-05-31 10:54 ` redi at gcc dot gnu.org
  2014-05-31 10:59 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-31 10:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61374

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61374] string_view::operator string() is buggy
  2014-05-31  2:21 [Bug libstdc++/61374] New: string_view::operator string() is buggy john.salmon at deshaw dot com
  2014-05-31 10:54 ` [Bug libstdc++/61374] " redi at gcc dot gnu.org
@ 2014-05-31 10:59 ` redi at gcc dot gnu.org
  2014-06-01 17:24 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-31 10:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61374

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61374] string_view::operator string() is buggy
  2014-05-31  2:21 [Bug libstdc++/61374] New: string_view::operator string() is buggy john.salmon at deshaw dot com
  2014-05-31 10:54 ` [Bug libstdc++/61374] " redi at gcc dot gnu.org
  2014-05-31 10:59 ` redi at gcc dot gnu.org
@ 2014-06-01 17:24 ` redi at gcc dot gnu.org
  2014-06-01 17:25 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-06-01 17:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61374

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Sun Jun  1 17:23:41 2014
New Revision: 211113

URL: http://gcc.gnu.org/viewcvs?rev=211113&root=gcc&view=rev
Log:
    PR libstdc++/61374
    * include/experimental/string_view (operator basic_string): Correct
    order of arguments.
    (to_string): Replace with member function.
    Add inline specifiers. Remove unused header. Remove _S_empty_rep and
    allow _M_str to be null.
    * testsuite/experimental/string_view/cons/char/1.cc: Adjust to new
    default constructor semantics.
    * testsuite/experimental/string_view/cons/wchar_t/1.cc: Likewise.
    * testsuite/experimental/string_view/operations/copy/char/1.cc: Fix
    copyright dates. Remove unused header.
    * testsuite/experimental/string_view/operations/copy/wchar_t/1.cc:
    Likewise.
    * testsuite/experimental/string_view/operations/data/char/1.cc:
    Fix copyright dates. Adjust to new default constructor semantics.
    * testsuite/experimental/string_view/operations/data/wchar_t/1.cc:
    Likewise.
    * testsuite/experimental/string_view/operations/to_string/1.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/
   
trunk/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc
      - copied, changed from r211112,
trunk/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/experimental/string_view
    trunk/libstdc++-v3/include/experimental/string_view.tcc
    trunk/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
    trunk/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
   
trunk/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc
   
trunk/libstdc++-v3/testsuite/experimental/string_view/operations/copy/wchar_t/1.cc
   
trunk/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
   
trunk/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61374] string_view::operator string() is buggy
  2014-05-31  2:21 [Bug libstdc++/61374] New: string_view::operator string() is buggy john.salmon at deshaw dot com
                   ` (2 preceding siblings ...)
  2014-06-01 17:24 ` redi at gcc dot gnu.org
@ 2014-06-01 17:25 ` redi at gcc dot gnu.org
  2014-07-16 13:29 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-06-01 17:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61374

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk so far.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61374] string_view::operator string() is buggy
  2014-05-31  2:21 [Bug libstdc++/61374] New: string_view::operator string() is buggy john.salmon at deshaw dot com
                   ` (3 preceding siblings ...)
  2014-06-01 17:25 ` redi at gcc dot gnu.org
@ 2014-07-16 13:29 ` jakub at gcc dot gnu.org
  2014-08-04 18:50 ` redi at gcc dot gnu.org
  2014-08-04 18:52 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-07-16 13:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61374

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.1                       |4.9.2

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.1 has been released.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61374] string_view::operator string() is buggy
  2014-05-31  2:21 [Bug libstdc++/61374] New: string_view::operator string() is buggy john.salmon at deshaw dot com
                   ` (4 preceding siblings ...)
  2014-07-16 13:29 ` jakub at gcc dot gnu.org
@ 2014-08-04 18:50 ` redi at gcc dot gnu.org
  2014-08-04 18:52 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-04 18:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61374

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Mon Aug  4 18:50:14 2014
New Revision: 213601

URL: https://gcc.gnu.org/viewcvs?rev=213601&root=gcc&view=rev
Log:
Backported from mainline
2014-06-01  Jonathan Wakely  <jwakely@redhat.com>

    PR libstdc++/61374
    * include/experimental/string_view (operator basic_string): Correct
    order of arguments.
    (to_string): Replace with member function.
    Add inline specifiers. Remove unused header. Remove _S_empty_rep and
    allow _M_str to be null.
    * testsuite/experimental/string_view/cons/char/1.cc: Adjust to new
    default constructor semantics.
    * testsuite/experimental/string_view/cons/wchar_t/1.cc: Likewise.
    * testsuite/experimental/string_view/operations/copy/char/1.cc: Fix
    copyright dates. Remove unused header.
    * testsuite/experimental/string_view/operations/copy/wchar_t/1.cc:
    Likewise.
    * testsuite/experimental/string_view/operations/data/char/1.cc:
    Fix copyright dates. Adjust to new default constructor semantics.
    * testsuite/experimental/string_view/operations/data/wchar_t/1.cc:
    Likewise.
    * testsuite/experimental/string_view/operations/to_string/1.cc: New.

Added:
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc
      - copied, changed from r213600,
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc
Modified:
    branches/gcc-4_9-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_9-branch/libstdc++-v3/include/experimental/string_view
    branches/gcc-4_9-branch/libstdc++-v3/include/experimental/string_view.tcc
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/operations/copy/wchar_t/1.cc
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61374] string_view::operator string() is buggy
  2014-05-31  2:21 [Bug libstdc++/61374] New: string_view::operator string() is buggy john.salmon at deshaw dot com
                   ` (5 preceding siblings ...)
  2014-08-04 18:50 ` redi at gcc dot gnu.org
@ 2014-08-04 18:52 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-04 18:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61374

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
fixed for 4.9.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-04 18:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-31  2:21 [Bug libstdc++/61374] New: string_view::operator string() is buggy john.salmon at deshaw dot com
2014-05-31 10:54 ` [Bug libstdc++/61374] " redi at gcc dot gnu.org
2014-05-31 10:59 ` redi at gcc dot gnu.org
2014-06-01 17:24 ` redi at gcc dot gnu.org
2014-06-01 17:25 ` redi at gcc dot gnu.org
2014-07-16 13:29 ` jakub at gcc dot gnu.org
2014-08-04 18:50 ` redi at gcc dot gnu.org
2014-08-04 18:52 ` redi at gcc dot gnu.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).