[Bug c++/77419] Inconsistent behavior with auto& and __attribute__((unused))
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 14 19:43:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77419
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-09-14
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
Known to fail| |6.4.0, 7.3.0, 8.2.0, 9.0
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed with the top of trunk (GCC 9):
$ cat t.C && gcc -O2 -S -Wall t.C
int main() {
int __attribute__((unused)) int_var_unused = 42;
int int_var = 42;
int& __attribute__((unused)) int_ref = int_var;
auto __attribute__((unused)) auto_var_unused = 42;
auto auto_var = 42;
auto& __attribute__((unused)) auto_ref = auto_var;
return 0;
}
t.C: In function ‘int main()’:
t.C:8:35: warning: unused variable ‘auto_ref’ [-Wunused-variable]
8 | auto& __attribute__((unused)) auto_ref = auto_var;
| ^~~~~~~~
More information about the Gcc-bugs
mailing list