public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/57139] New: std::tuple conversion constructor does the wrong checks
@ 2013-05-01 19:03 vpozdyayev at gmail dot com
2013-05-01 21:52 ` [Bug libstdc++/57139] " redi at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: vpozdyayev at gmail dot com @ 2013-05-01 19:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57139
Bug #: 57139
Summary: std::tuple conversion constructor does the wrong
checks
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: vpozdyayev@gmail.com
As per Std 20.4.2.1/14, the "template <class... UTypes> tuple(const
tuple<UTypes...>& u)" constructor should require "is_constructible<Ti, const
Ui&>". However, the implementation checks "is_convertible<const _UElements&,
_Elements>", which implies copy constructibility requirement for destination
types. As a result:
#include <type_traits>
#include <tuple>
class A { };
class B { public: B( A const &a ) { } private: B( B const & ); };
static_assert( std::is_constructible< B, A const & >::value, "test" ); // OK
static_assert( std::is_convertible< A, B >::value, "test" ); // fail
static_assert( std::is_constructible< std::tuple<B>, std::tuple<A> >::value,
"test" ); // fail
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/57139] std::tuple conversion constructor does the wrong checks
2013-05-01 19:03 [Bug libstdc++/57139] New: std::tuple conversion constructor does the wrong checks vpozdyayev at gmail dot com
@ 2013-05-01 21:52 ` redi at gcc dot gnu.org
2013-05-02 5:23 ` vpozdyayev at gmail dot com
2013-05-06 11:35 ` daniel.kruegler at googlemail dot com
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-01 21:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57139
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-05-01 21:52:19 UTC ---
That's what the Requires: clause says, but see also:
Remark: This constructor shall not participate in overload resolution unless
const Ui& is implicitly convertible to Ti for all i.
is_constructible does not enforce implicit convertibility, we need an
additional check, which is why we use is_convertible. The SFINAE constraint is
there to implement the Remark, not the Requires clause (which is the user's
responsibility to meet not the implementation's.)
Also note that it only requires move constructibility, not necessarily copy
constructibility.
I thought the code was wrong too and changed those constraints with
http://gcc.gnu.org/ml/libstdc++/2011-05/msg00126.html and then reverted it with
http://gcc.gnu.org/ml/libstdc++/2011-05/msg00129.html
I think there will be a paper in the next WG21 mailing addressing this topic.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/57139] std::tuple conversion constructor does the wrong checks
2013-05-01 19:03 [Bug libstdc++/57139] New: std::tuple conversion constructor does the wrong checks vpozdyayev at gmail dot com
2013-05-01 21:52 ` [Bug libstdc++/57139] " redi at gcc dot gnu.org
@ 2013-05-02 5:23 ` vpozdyayev at gmail dot com
2013-05-06 11:35 ` daniel.kruegler at googlemail dot com
2 siblings, 0 replies; 4+ messages in thread
From: vpozdyayev at gmail dot com @ 2013-05-02 5:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57139
--- Comment #2 from vpozdyayev at gmail dot com 2013-05-02 05:22:57 UTC ---
Good point. Sadly, is_convertible is not equivalent to implicit convertibility
exactly due to that additional requirement (not sure if the latter is
intentional, or an StdLib defect).
Does the paper you mention address std::tuple or std::is_convertible?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/57139] std::tuple conversion constructor does the wrong checks
2013-05-01 19:03 [Bug libstdc++/57139] New: std::tuple conversion constructor does the wrong checks vpozdyayev at gmail dot com
2013-05-01 21:52 ` [Bug libstdc++/57139] " redi at gcc dot gnu.org
2013-05-02 5:23 ` vpozdyayev at gmail dot com
@ 2013-05-06 11:35 ` daniel.kruegler at googlemail dot com
2 siblings, 0 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-05-06 11:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57139
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-05-06 11:35:05 UTC ---
(In reply to comment #2)
> Good point. Sadly, is_convertible is not equivalent to implicit convertibility
> exactly due to that additional requirement (not sure if the latter is
> intentional, or an StdLib defect).
If at all this would be a core-language defect.
> Does the paper you mention address std::tuple or std::is_convertible?
The paper addresses std::tuple and std::pair. I don't see how the Library could
change std::is_convertible, because it does exactly what the core language
semantics require. The document number will be N3680 in the post-meeting
mailing.
>From gcc-bugs-return-421683-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon May 06 11:37:58 2013
Return-Path: <gcc-bugs-return-421683-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10787 invoked by alias); 6 May 2013 11:37:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 10752 invoked by uid 55); 6 May 2013 11:37:55 -0000
From: "js at lastlog dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/51927] [C++0x] Cannot access non-static members in initializer
Date: Mon, 06 May 2013 11:37:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Keywords: rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: js at lastlog dot de
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-51927-4-cOr9N4uBTj@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-51927-4@http.gcc.gnu.org/bugzilla/>
References: <bug-51927-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg00356.txt.bz2
Content-length: 860
http://gcc.gnu.org/bugzilla/show_bug.cgi?idQ927
--- Comment #7 from js at lastlog dot de 2013-05-06 11:37:54 UTC ---
which gcc version will have that patch applied?
thanks for fixing, hope libcppa will work with gcc now again!
On 05/04/2013 02:33 PM, paolo.carlini at oracle dot com wrote:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?idQ927
>
> Paolo Carlini <paolo.carlini at oracle dot com> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|NEW |RESOLVED
> Blocks| |54367
> Resolution| |FIXED
>
> --- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-05-04 12:33:13 UTC ---
> Done.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-06 11:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-01 19:03 [Bug libstdc++/57139] New: std::tuple conversion constructor does the wrong checks vpozdyayev at gmail dot com
2013-05-01 21:52 ` [Bug libstdc++/57139] " redi at gcc dot gnu.org
2013-05-02 5:23 ` vpozdyayev at gmail dot com
2013-05-06 11:35 ` daniel.kruegler at googlemail dot com
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).