public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58714] Bogus value category in ternary operator?
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
@ 2013-10-13 13:06 ` paolo.carlini at oracle dot com
2013-10-13 13:26 ` ali.baharev at gmail dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-13 13:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Dup
*** This bug has been marked as a duplicate of bug 53000 ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus value category in ternary operator?
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
2013-10-13 13:06 ` [Bug c++/58714] Bogus value category in ternary operator? paolo.carlini at oracle dot com
@ 2013-10-13 13:26 ` ali.baharev at gmail dot com
2013-10-13 14:16 ` glisse at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: ali.baharev at gmail dot com @ 2013-10-13 13:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
--- Comment #2 from Ali Baharev <ali.baharev at gmail dot com> ---
OK, sorry for the dupe.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus value category in ternary operator?
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
2013-10-13 13:06 ` [Bug c++/58714] Bogus value category in ternary operator? paolo.carlini at oracle dot com
2013-10-13 13:26 ` ali.baharev at gmail dot com
@ 2013-10-13 14:16 ` glisse at gcc dot gnu.org
2013-10-14 21:12 ` [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional glisse at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-10-13 14:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |NEW
Last reconfirmed| |2013-10-13
CC| |glisse at gcc dot gnu.org
Resolution|DUPLICATE |---
Ever confirmed|0 |1
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
The quoted paragraph is implemented in gcc-4.9. However, this still fails. The
strange thing is that both of these versions work:
static_cast<X&>(t ? a : b) = X{};
(t ? a : b) = static_cast<X&&>(X{});
There is special code in cp_build_modify_expr to handle assignment to a
conditional, but it contains this line:
rhs = stabilize_expr (rhs, &preeval);
which apparently loses the prvalue-ness of rhs.
I think we can consider it as a different issue from PR 53000, because
operator?: worked ok, it is the later assignment which failed. By the way, this
C++03 version:
struct X {
private:
X& operator=(const X&);
X& operator=(X& );
};
void f(bool t) {
X a, b;
*(t ? &a : &b) = X();
(t ? a : b) = X();
}
says:
c.cc: In function 'void f(bool)':
c.cc:3:6: error: 'X& X::operator=(const X&)' is private
X& operator=(const X&);
^
c.cc:9:18: error: within this context
*(t ? &a : &b) = X();
^
c.cc:4:6: error: 'X& X::operator=(X&)' is private
X& operator=(X& );
^
c.cc:10:15: error: within this context
(t ? a : b) = X();
^
c.cc:4:6: error: 'X& X::operator=(X&)' is private
X& operator=(X& );
^
c.cc:10:15: error: within this context
(t ? a : b) = X();
^
The fact that it tries to use X::operator=(X&) seems like a bug, which could
easily be turned into wrong-code.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2013-10-13 14:16 ` glisse at gcc dot gnu.org
@ 2013-10-14 21:12 ` glisse at gcc dot gnu.org
2013-10-14 21:15 ` paolo.carlini at oracle dot com
` (6 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-10-14 21:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
The C++03 wrong-code version:
struct X {
X& operator=(const X&){}
X& operator=(X&){__builtin_abort();}
};
int main(int argv,char**) {
X a, b;
((argv > 2) ? a : b) = X();
}
I don't know if stabilize_expr is wrong, or if it is wrong to call it, I'll
leave that to someone else.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2013-10-14 21:12 ` [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional glisse at gcc dot gnu.org
@ 2013-10-14 21:15 ` paolo.carlini at oracle dot com
2014-05-09 18:16 ` jason at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-14 21:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2013-10-14 21:15 ` paolo.carlini at oracle dot com
@ 2014-05-09 18:16 ` jason at gcc dot gnu.org
2014-05-09 18:19 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-05-09 18:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri May 9 18:16:05 2014
New Revision: 210283
URL: http://gcc.gnu.org/viewcvs?rev=210283&root=gcc&view=rev
Log:
PR c++/58714
* tree.c (stabilize_expr): A stabilized prvalue is an xvalue.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C
trunk/gcc/testsuite/g++.dg/expr/cond12.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/tree.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2014-05-09 18:16 ` jason at gcc dot gnu.org
@ 2014-05-09 18:19 ` jason at gcc dot gnu.org
2014-08-07 18:55 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-05-09 18:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed on trunk currently.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2014-05-09 18:19 ` jason at gcc dot gnu.org
@ 2014-08-07 18:55 ` jason at gcc dot gnu.org
2014-08-07 18:56 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-08-07 18:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Thu Aug 7 18:54:27 2014
New Revision: 213724
URL: https://gcc.gnu.org/viewcvs?rev=213724&root=gcc&view=rev
Log:
PR c++/58714
* tree.c (stabilize_expr): A stabilized prvalue is an xvalue.
Added:
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/expr/cond12.C
Modified:
branches/gcc-4_9-branch/gcc/cp/ChangeLog
branches/gcc-4_9-branch/gcc/cp/tree.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2014-08-07 18:55 ` jason at gcc dot gnu.org
@ 2014-08-07 18:56 ` jason at gcc dot gnu.org
2014-08-07 19:50 ` jason at gcc dot gnu.org
2014-08-07 19:52 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-08-07 18:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.9.2
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.9.2.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2014-08-07 18:56 ` jason at gcc dot gnu.org
@ 2014-08-07 19:50 ` jason at gcc dot gnu.org
2014-08-07 19:52 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-08-07 19:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Thu Aug 7 19:50:04 2014
New Revision: 213734
URL: https://gcc.gnu.org/viewcvs?rev=213734&root=gcc&view=rev
Log:
PR c++/58714
* tree.c (stabilize_expr): A stabilized prvalue is an xvalue.
Added:
branches/gcc-4_8-branch/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C
branches/gcc-4_8-branch/gcc/testsuite/g++.dg/expr/cond12.C
Modified:
branches/gcc-4_8-branch/gcc/cp/ChangeLog
branches/gcc-4_8-branch/gcc/cp/tree.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2014-08-07 19:50 ` jason at gcc dot gnu.org
@ 2014-08-07 19:52 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-08-07 19:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58714
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.9.2 |4.8.4
--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> ---
And 4.8.4.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-08-07 19:52 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-58714-4@http.gcc.gnu.org/bugzilla/>
2013-10-13 13:06 ` [Bug c++/58714] Bogus value category in ternary operator? paolo.carlini at oracle dot com
2013-10-13 13:26 ` ali.baharev at gmail dot com
2013-10-13 14:16 ` glisse at gcc dot gnu.org
2013-10-14 21:12 ` [Bug c++/58714] Bogus overload resolution for the assignment operator in assignment to a conditional glisse at gcc dot gnu.org
2013-10-14 21:15 ` paolo.carlini at oracle dot com
2014-05-09 18:16 ` jason at gcc dot gnu.org
2014-05-09 18:19 ` jason at gcc dot gnu.org
2014-08-07 18:55 ` jason at gcc dot gnu.org
2014-08-07 18:56 ` jason at gcc dot gnu.org
2014-08-07 19:50 ` jason at gcc dot gnu.org
2014-08-07 19:52 ` jason 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).