public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100608] New: [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type
@ 2021-05-14 21:38 nok.raven at gmail dot com
2021-05-17 12:30 ` [Bug c++/100608] " rguenth at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: nok.raven at gmail dot com @ 2021-05-14 21:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100608
Bug ID: 100608
Summary: [10/11/12 Regression] -Wshadow=compatible-local false
positive: function local type declaration shadows
variable of different type
Product: gcc
Version: 10.3.1
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nok.raven at gmail dot com
Target Milestone: ---
template <typename> class X {};
void foo()
{
auto a = X<class a>{};
}
<source>: In function 'void foo()':
<source>:5:22: warning: declaration of 'struct foo()::a' shadows a previous
local [-Wshadow=compatible-local]
5 | auto a = X<class a>{};
| ^
<source>:5:10: note: shadowed declaration is here
5 | auto a = X<class a>{};
| ^
https://godbolt.org/z/hzoro9v3Y
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100608] [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type
2021-05-14 21:38 [Bug c++/100608] New: [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type nok.raven at gmail dot com
@ 2021-05-17 12:30 ` rguenth at gcc dot gnu.org
2022-04-05 20:16 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-17 12:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100608
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Target Milestone|--- |10.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100608] [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type
2021-05-14 21:38 [Bug c++/100608] New: [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type nok.raven at gmail dot com
2021-05-17 12:30 ` [Bug c++/100608] " rguenth at gcc dot gnu.org
@ 2022-04-05 20:16 ` jason at gcc dot gnu.org
2022-04-06 14:31 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-05 20:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100608
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |92024
Last reconfirmed| |2022-04-05
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
CC| |edlinger at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
This was changed by the patch for PR92024. In the comment for that patch,
Bernd wrote "I think shadowing one type with another type of the same name is
always a no no" but then warns if either old or new decl is a type. I think a
type and a non-type can't really be considered compatible. Testing a patch.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92024
[Bug 92024] crash in check_local_shadow
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100608] [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type
2021-05-14 21:38 [Bug c++/100608] New: [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type nok.raven at gmail dot com
2021-05-17 12:30 ` [Bug c++/100608] " rguenth at gcc dot gnu.org
2022-04-05 20:16 ` jason at gcc dot gnu.org
@ 2022-04-06 14:31 ` cvs-commit at gcc dot gnu.org
2022-04-12 20:14 ` [Bug c++/100608] [10/11 " cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-06 14:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100608
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:fd0024e48e94008915a6b18112efbbd8abc81ed8
commit r12-8021-gfd0024e48e94008915a6b18112efbbd8abc81ed8
Author: Jason Merrill <jason@redhat.com>
Date: Tue Apr 5 16:02:04 2022 -0400
c++: -Wshadow=compatible-local type vs var [PR100608]
The patch for PR92024 changed -Wshadow=compatible-local to warn if either
new or old decl was a type, but the rationale only talked about the case
where both are types. If only one is, they aren't compatible.
PR c++/100608
gcc/cp/ChangeLog:
* name-lookup.cc (check_local_shadow): Use -Wshadow=local
if exactly one of 'old' and 'decl' is a type.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wshadow-compatible-local-3.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100608] [10/11 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type
2021-05-14 21:38 [Bug c++/100608] New: [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type nok.raven at gmail dot com
` (2 preceding siblings ...)
2022-04-06 14:31 ` cvs-commit at gcc dot gnu.org
@ 2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
2022-05-12 21:14 ` [Bug c++/100608] [10 " cvs-commit at gcc dot gnu.org
2022-05-12 21:37 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-12 20:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100608
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:c52cd0b35d356565f67f7956f4defc022dfa2172
commit r11-9829-gc52cd0b35d356565f67f7956f4defc022dfa2172
Author: Jason Merrill <jason@redhat.com>
Date: Tue Apr 5 16:02:04 2022 -0400
c++: -Wshadow=compatible-local type vs var [PR100608]
The patch for PR92024 changed -Wshadow=compatible-local to warn if either
new or old decl was a type, but the rationale only talked about the case
where both are types. If only one is, they aren't compatible.
PR c++/100608
gcc/cp/ChangeLog:
* name-lookup.c (check_local_shadow): Use -Wshadow=local
if exactly one of 'old' and 'decl' is a type.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wshadow-compatible-local-3.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100608] [10 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type
2021-05-14 21:38 [Bug c++/100608] New: [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type nok.raven at gmail dot com
` (3 preceding siblings ...)
2022-04-12 20:14 ` [Bug c++/100608] [10/11 " cvs-commit at gcc dot gnu.org
@ 2022-05-12 21:14 ` cvs-commit at gcc dot gnu.org
2022-05-12 21:37 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-12 21:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100608
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:b01044ec7fbed24e9394bcf49e524acdd52849e7
commit r10-10720-gb01044ec7fbed24e9394bcf49e524acdd52849e7
Author: Jason Merrill <jason@redhat.com>
Date: Tue Apr 5 16:02:04 2022 -0400
c++: -Wshadow=compatible-local type vs var [PR100608]
The patch for PR92024 changed -Wshadow=compatible-local to warn if either
new or old decl was a type, but the rationale only talked about the case
where both are types. If only one is, they aren't compatible.
PR c++/100608
gcc/cp/ChangeLog:
* name-lookup.c (check_local_shadow): Use -Wshadow=local
if exactly one of 'old' and 'decl' is a type.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wshadow-compatible-local-3.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100608] [10 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type
2021-05-14 21:38 [Bug c++/100608] New: [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type nok.raven at gmail dot com
` (4 preceding siblings ...)
2022-05-12 21:14 ` [Bug c++/100608] [10 " cvs-commit at gcc dot gnu.org
@ 2022-05-12 21:37 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-12 21:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100608
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-05-12 21:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 21:38 [Bug c++/100608] New: [10/11/12 Regression] -Wshadow=compatible-local false positive: function local type declaration shadows variable of different type nok.raven at gmail dot com
2021-05-17 12:30 ` [Bug c++/100608] " rguenth at gcc dot gnu.org
2022-04-05 20:16 ` jason at gcc dot gnu.org
2022-04-06 14:31 ` cvs-commit at gcc dot gnu.org
2022-04-12 20:14 ` [Bug c++/100608] [10/11 " cvs-commit at gcc dot gnu.org
2022-05-12 21:14 ` [Bug c++/100608] [10 " cvs-commit at gcc dot gnu.org
2022-05-12 21:37 ` 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).