public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53000] New: Trinary operator does not behave as standardized
@ 2012-04-15 23:37 gcc-bugs at quasiparticle dot net
  2012-04-24 14:33 ` [Bug c++/53000] Conditional " ismail at namtrac dot org
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: gcc-bugs at quasiparticle dot net @ 2012-04-15 23:37 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53000
           Summary: Trinary operator does not behave as standardized
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gcc-bugs@quasiparticle.net


The conditional operator as implemented in g++ from 4.7.0 (at least) onwards
does not behave as required by [expr.cond]p3 of the C++11 spec.

Given an expression "B ? E1 : E2", the result of the expression is required to
be an xvalue if E2 is an xvalue and E1 can be converted to T2&&. With E1 and E2
both being declval<int>(), the result should then be of type int&&, while g++
currently generates a plain int there.

Curiosly, this hides an oversight described in DR2141 [1], which reports the
common_type<T, U> trait as being defective. As soon as "true ? declval<int>() :
declval<int>()" yields int&& as required, common_type<int, int>::type of
libstdc++ will be int&& (is int right now). This will break <chrono> badly, as
experienced by clang++.


[1] http://cplusplus.github.com/LWG/lwg-active.html#2141


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

end of thread, other threads:[~2014-10-15 20:08 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-15 23:37 [Bug c++/53000] New: Trinary operator does not behave as standardized gcc-bugs at quasiparticle dot net
2012-04-24 14:33 ` [Bug c++/53000] Conditional " ismail at namtrac dot org
2012-04-24 14:48 ` redi at gcc dot gnu.org
2012-04-24 19:32 ` marc.glisse at normalesup dot org
2012-04-24 21:49 ` redi at gcc dot gnu.org
2012-04-24 22:36 ` marc.glisse at normalesup dot org
2012-04-24 22:46 ` pinskia at gcc dot gnu.org
2012-04-24 23:24 ` marc.glisse at normalesup dot org
2012-04-28  3:49 ` pinskia at gcc dot gnu.org
2012-05-20 15:54 ` ismail at namtrac dot org
2012-10-04 15:57 ` paolo.carlini at oracle dot com
2012-10-10  9:54 ` paolo.carlini at oracle dot com
2012-10-10 10:28 ` glisse at gcc dot gnu.org
2012-10-10 10:42 ` daniel.kruegler at googlemail dot com
2012-10-10 10:43 ` paolo.carlini at oracle dot com
2012-10-10 10:45 ` paolo.carlini at oracle dot com
2012-10-10 10:55 ` daniel.kruegler at googlemail dot com
2012-10-10 11:02 ` paolo.carlini at oracle dot com
2012-10-10 11:04 ` daniel.kruegler at googlemail dot com
2012-10-10 11:06 ` paolo.carlini at oracle dot com
2012-10-10 11:08 ` daniel.kruegler at googlemail dot com
2012-10-10 11:10 ` paolo.carlini at oracle dot com
2012-10-10 11:43 ` paolo.carlini at oracle dot com
2012-10-10 11:45 ` glisse at gcc dot gnu.org
2012-10-10 11:47 ` paolo.carlini at oracle dot com
2013-07-09 16:03 ` glisse at gcc dot gnu.org
2013-10-13 13:06 ` paolo.carlini at oracle dot com
2014-05-09 18:24 ` jason at gcc dot gnu.org
2014-10-15  9:02 ` paolo.carlini at oracle dot com
2014-10-15 20:08 ` 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).