[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2021-06-08 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|--- |10.0

[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2021-06-08 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

Jonathan Wakely  changed:

   What|Removed |Added

 CC||mattreecebentley at gmail dot 
com

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

[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2019-08-27 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Marek Polacek  ---
Fixed.

[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2019-08-27 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

--- Comment #6 from Marek Polacek  ---
Author: mpolacek
Date: Wed Aug 28 02:22:29 2019
New Revision: 274982

URL: https://gcc.gnu.org/viewcvs?rev=274982=gcc=rev
Log:
PR c++/81676 - bogus -Wunused warnings in constexpr if.
* semantics.c (maybe_mark_exp_read_r): New function.
(finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.

* g++.dg/cpp1z/constexpr-if31.C: New test.
* g++.dg/cpp1z/constexpr-if32.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp1z/constexpr-if31.C
trunk/gcc/testsuite/g++.dg/cpp1z/constexpr-if32.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2019-08-16 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

Marek Polacek  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #5 from Marek Polacek  ---
Well, patch posted: https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01196.html

I'm not very optimistic about it being accepted, but so far no one has
submitted anything better.

[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2019-08-16 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

--- Comment #4 from Marek Polacek  ---
The problem seems to be that we're losing DECL_READ_P on the parm_decl v.

[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2019-08-16 Thread vittorio.romeo at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

Vittorio Romeo  changed:

   What|Removed |Added

 CC||vittorio.romeo at outlook dot 
com

--- Comment #3 from Vittorio Romeo  ---
Found this today, still present in gcc trunk (9.2+). Example:

int main()
{
auto f = [](auto a, auto b) {
if constexpr (sizeof(b) == 1) {
return a;
} else {
return b;
}
};

return f(1, 1) + f(1, 'a');
}

https://gcc.godbolt.org/z/SOvLEV

[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2017-12-01 Thread benni.buch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

--- Comment #2 from Benjamin Buch  ---
Does still exist in:

$ g++ --version
g++ (GCC) 8.0.0 20171201 (experimental)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c++/81676] Wrong warning with unused-but-set-parameter within 'if constexpr'

2017-08-03 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-03
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.