public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/55861] New: [C++11] `std::shared_future::get' is not const-qualified
@ 2013-01-03 14:12 ai.azuma at gmail dot com
  2013-01-03 14:22 ` [Bug libstdc++/55861] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ai.azuma at gmail dot com @ 2013-01-03 14:12 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55861
           Summary: [C++11] `std::shared_future::get' is not
                    const-qualified
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ai.azuma@gmail.com


`std::shared_future<R>::get' member function is specified as const-qualified in
[futures.shared_future]. However, libstdc++'s implementation is not. A testcase
would be as follows;

//--------------------------------------------------
#include <future>

int f()
{
  return 42;
}

int main()
{
  std::shared_future<int> const ftr(std::async(&f));
  ftr.get(); // Line 11
}
//--------------------------------------------------

For the above testcase, GCC 4.8.0 20121230 complains as follows;

main.cpp: In function 'int main()':
main.cpp:11:11: error: passing 'const std::shared_future<int>' as 'this'
argument of 'const _Res& std::shared_future<_Res>::get() [with _Res = int]'
discards qualifiers [-fpermissive]
   ftr.get();
           ^


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

* [Bug libstdc++/55861] [C++11] `std::shared_future::get' is not const-qualified
  2013-01-03 14:12 [Bug libstdc++/55861] New: [C++11] `std::shared_future::get' is not const-qualified ai.azuma at gmail dot com
@ 2013-01-03 14:22 ` redi at gcc dot gnu.org
  2013-01-19 23:43 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-03 14:22 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-01-03
         AssignedTo|unassigned at gcc dot       |redi at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-03 14:22:05 UTC ---
The fix should be as simple as adding "const" to __basic_future::_M_get_result
and the three shared_future::get() functions.


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

* [Bug libstdc++/55861] [C++11] `std::shared_future::get' is not const-qualified
  2013-01-03 14:12 [Bug libstdc++/55861] New: [C++11] `std::shared_future::get' is not const-qualified ai.azuma at gmail dot com
  2013-01-03 14:22 ` [Bug libstdc++/55861] " redi at gcc dot gnu.org
@ 2013-01-19 23:43 ` redi at gcc dot gnu.org
  2013-01-19 23:44 ` redi at gcc dot gnu.org
  2013-09-26 19:04 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-19 23:43 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-19 23:43:01 UTC ---
Author: redi
Date: Sat Jan 19 23:42:55 2013
New Revision: 195314

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195314
Log:
    PR libstdc++/55861
    * include/std/future (_State_base::_S_check(const shared_ptr<T>&)):
    Fix return type.
    (__basic_future::_M_get_result()): Const qualify.
    (shared_future::get()): Likewise.
    * testsuite/30_threads/shared_future/members/get.cc: Use const
    objects.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/future
    trunk/libstdc++-v3/testsuite/30_threads/shared_future/members/get.cc


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

* [Bug libstdc++/55861] [C++11] `std::shared_future::get' is not const-qualified
  2013-01-03 14:12 [Bug libstdc++/55861] New: [C++11] `std::shared_future::get' is not const-qualified ai.azuma at gmail dot com
  2013-01-03 14:22 ` [Bug libstdc++/55861] " redi at gcc dot gnu.org
  2013-01-19 23:43 ` redi at gcc dot gnu.org
@ 2013-01-19 23:44 ` redi at gcc dot gnu.org
  2013-09-26 19:04 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-19 23:44 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-19 23:44:16 UTC ---
fixed for 4.8


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

* [Bug libstdc++/55861] [C++11] `std::shared_future::get' is not const-qualified
  2013-01-03 14:12 [Bug libstdc++/55861] New: [C++11] `std::shared_future::get' is not const-qualified ai.azuma at gmail dot com
                   ` (2 preceding siblings ...)
  2013-01-19 23:44 ` redi at gcc dot gnu.org
@ 2013-09-26 19:04 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-09-26 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu Sep 26 19:04:04 2013
New Revision: 202956

URL: http://gcc.gnu.org/viewcvs?rev=202956&root=gcc&view=rev
Log:
    Backport from mainline

    2013-01-19  Jonathan Wakely  <jwakely.gcc@gmail.com>

    PR libstdc++/55861
    * include/std/future (_State_base::_S_check(const shared_ptr<T>&)):
    Fix return type.

Modified:
    branches/gcc-4_7-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_7-branch/libstdc++-v3/include/std/future


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

end of thread, other threads:[~2013-09-26 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03 14:12 [Bug libstdc++/55861] New: [C++11] `std::shared_future::get' is not const-qualified ai.azuma at gmail dot com
2013-01-03 14:22 ` [Bug libstdc++/55861] " redi at gcc dot gnu.org
2013-01-19 23:43 ` redi at gcc dot gnu.org
2013-01-19 23:44 ` redi at gcc dot gnu.org
2013-09-26 19:04 ` 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).