public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106051] New: -Wmismatched-tags gives false positive warning when "class C" is "using namespace"d into a namespace with another "class C" declaration
@ 2022-06-22 0:13 beardsley.matt.j at gmail dot com
2022-06-22 10:56 ` [Bug c++/106051] " redi at gcc dot gnu.org
2022-06-22 10:56 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: beardsley.matt.j at gmail dot com @ 2022-06-22 0:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106051
Bug ID: 106051
Summary: -Wmismatched-tags gives false positive warning when
"class C" is "using namespace"d into a namespace with
another "class C" declaration
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: beardsley.matt.j at gmail dot com
Target Milestone: ---
https://godbolt.org/z/sx8aT3EKh
The following uses gcc built from a fresh repo that I just cloned earlier today
(default build settings)
tmp.cpp:
namespace ns {
class C {};
}
using namespace ns;
class C;
No ambiguity with the warning off:
$ g++ -c tmp.cpp -o /dev/null -Wno-mismatched-tags
(no output)
Now it's ambiguous (also refers to it as "struct C" but it's really "class C")
$ g++ -c tmp.cpp -o /dev/null -Wmismatched-tags
tmp.cpp:5:7: error: reference to ‘C’ is ambiguous
5 | class C;
| ^
tmp.cpp:2:7: note: candidates are: ‘class ns::C’
2 | class C {};
| ^
tmp.cpp:5:7: note: ‘struct C’
5 | class C;
| ^
Not sure how noteworthy this is but if the last 2 lines are swapped the warning
goes away:
tmp.cpp:
namespace ns {
class C {};
}
class C;
using namespace ns;
$ g++ -c tmp.cpp -o /dev/null -Wno-mismatched-tags
(no output)
$ g++ -c tmp.cpp -o /dev/null -Wmismatched-tags
(no output)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/106051] -Wmismatched-tags gives false positive warning when "class C" is "using namespace"d into a namespace with another "class C" declaration
2022-06-22 0:13 [Bug c++/106051] New: -Wmismatched-tags gives false positive warning when "class C" is "using namespace"d into a namespace with another "class C" declaration beardsley.matt.j at gmail dot com
@ 2022-06-22 10:56 ` redi at gcc dot gnu.org
2022-06-22 10:56 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-22 10:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106051
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
CC| |msebor at gcc dot gnu.org
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed. The -Wmismatched-tags warnings has always caused this incorrect
error since it was added in r279480
I don't think it qualifies as a regression, because using -Wmismatched-tags was
an error before that commit anyway, because the warning didn't exist at all.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/106051] -Wmismatched-tags gives false positive warning when "class C" is "using namespace"d into a namespace with another "class C" declaration
2022-06-22 0:13 [Bug c++/106051] New: -Wmismatched-tags gives false positive warning when "class C" is "using namespace"d into a namespace with another "class C" declaration beardsley.matt.j at gmail dot com
2022-06-22 10:56 ` [Bug c++/106051] " redi at gcc dot gnu.org
@ 2022-06-22 10:56 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-22 10:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106051
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-06-22
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-22 10:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 0:13 [Bug c++/106051] New: -Wmismatched-tags gives false positive warning when "class C" is "using namespace"d into a namespace with another "class C" declaration beardsley.matt.j at gmail dot com
2022-06-22 10:56 ` [Bug c++/106051] " redi at gcc dot gnu.org
2022-06-22 10:56 ` redi 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).