[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-09-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |8.5

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-04-22 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Jakub Jelinek  ---
Fixed.

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-04-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

--- Comment #9 from CVS Commits  ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:cfe0485ff571a7cd27d2c1115f1fea1a5fecc17c

commit r8-10894-gcfe0485ff571a7cd27d2c1115f1fea1a5fecc17c
Author: Jakub Jelinek 
Date:   Wed Mar 3 16:12:23 2021 +0100

c++: Fix -fstrong-eval-order for operator &&, || and , [PR82959]

P0145R3 added
"However, the operands are sequenced in the order prescribed for the
built-in
operator" rule for overloaded operator calls when using the operator
syntax.
op_is_ordered follows that, but added just the overloaded operators
added in that paper.  &&, || and comma operators had rules that
lhs is sequenced before rhs already in C++98.
The following patch adds those cases to op_is_ordered.

2021-03-03  Jakub Jelinek  

PR c++/82959
* call.c (op_is_ordered): Handle TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR
and COMPOUND_EXPR.

* g++.dg/cpp1z/eval-order10.C: New test.

(cherry picked from commit 529e3b3402bd2a97b02318bd834df72815be5f0f)

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-04-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

--- Comment #8 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:6c085d6d783f38f008ea54f80b43f6b8e8f6b971

commit r9-9429-g6c085d6d783f38f008ea54f80b43f6b8e8f6b971
Author: Jakub Jelinek 
Date:   Wed Mar 3 16:12:23 2021 +0100

c++: Fix -fstrong-eval-order for operator &&, || and , [PR82959]

P0145R3 added
"However, the operands are sequenced in the order prescribed for the
built-in
operator" rule for overloaded operator calls when using the operator
syntax.
op_is_ordered follows that, but added just the overloaded operators
added in that paper.  &&, || and comma operators had rules that
lhs is sequenced before rhs already in C++98.
The following patch adds those cases to op_is_ordered.

2021-03-03  Jakub Jelinek  

PR c++/82959
* call.c (op_is_ordered): Handle TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR
and COMPOUND_EXPR.

* g++.dg/cpp1z/eval-order10.C: New test.

(cherry picked from commit 529e3b3402bd2a97b02318bd834df72815be5f0f)

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-03-19 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

--- Comment #7 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:529e3b3402bd2a97b02318bd834df72815be5f0f

commit r10-9480-g529e3b3402bd2a97b02318bd834df72815be5f0f
Author: Jakub Jelinek 
Date:   Wed Mar 3 16:12:23 2021 +0100

c++: Fix -fstrong-eval-order for operator &&, || and , [PR82959]

P0145R3 added
"However, the operands are sequenced in the order prescribed for the
built-in
operator" rule for overloaded operator calls when using the operator
syntax.
op_is_ordered follows that, but added just the overloaded operators
added in that paper.  &&, || and comma operators had rules that
lhs is sequenced before rhs already in C++98.
The following patch adds those cases to op_is_ordered.

2021-03-03  Jakub Jelinek  

PR c++/82959
* call.c (op_is_ordered): Handle TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR
and COMPOUND_EXPR.

* g++.dg/cpp1z/eval-order10.C: New test.

(cherry picked from commit 0b8fa12015f717ac7e4fe2ffbad96a0cb0df2584)

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-03-03 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

--- Comment #6 from Jakub Jelinek  ---
Fixed on the trunk so far.

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-03-03 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:0b8fa12015f717ac7e4fe2ffbad96a0cb0df2584

commit r11-7485-g0b8fa12015f717ac7e4fe2ffbad96a0cb0df2584
Author: Jakub Jelinek 
Date:   Wed Mar 3 16:12:23 2021 +0100

c++: Fix -fstrong-eval-order for operator &&, || and , [PR82959]

P0145R3 added
"However, the operands are sequenced in the order prescribed for the
built-in
operator" rule for overloaded operator calls when using the operator
syntax.
op_is_ordered follows that, but added just the overloaded operators
added in that paper.  &&, || and comma operators had rules that
lhs is sequenced before rhs already in C++98.
The following patch adds those cases to op_is_ordered.

2021-03-03  Jakub Jelinek  

PR c++/82959
* call.c (op_is_ordered): Handle TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR
and COMPOUND_EXPR.

* g++.dg/cpp1z/eval-order10.C: New test.

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-03-02 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

Jakub Jelinek  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Status|NEW |ASSIGNED

--- Comment #4 from Jakub Jelinek  ---
Created attachment 50285
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50285=edit
gcc11-pr82959.patch

Untested fix.

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-03-02 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-03-02

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2021-03-02 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

Jonathan Wakely  changed:

   What|Removed |Added

 CC||aatsnps at gmail dot com

--- Comment #3 from Jonathan Wakely  ---
*** Bug 99335 has been marked as a duplicate of this bug. ***

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2017-11-14 Thread mukesh.kapoor at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

Mukesh Kapoor  changed:

   What|Removed |Added

 CC||mukesh.kapoor at oracle dot com

--- Comment #2 from Mukesh Kapoor  ---
Here is a reduced test case that shows the same problem:

extern "C" int printf(const char*, ...);

class Int {
public:
  bool operator&&(const Int& rhs) const { return val && rhs.val; }
private:
  int val = 0;
};

int main()
{
  Int xx;
  (printf("first\n"), xx) && (printf("second\n"), xx);
};

[Bug c++/82959] g++ doesn't appreciate C++17 evaluation order rules for overloaded operators

2017-11-13 Thread ixsci at yandex dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82959

--- Comment #1 from Evgeniy Shcherbina  ---
Not that it matters much, but it should be "int i = -1;" in the code to match
my description fully.