public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106791] New: [12 Regression] Operator Lookup with using namespace
@ 2022-08-31 12:57 gcc at hazardy dot de
2022-08-31 13:05 ` [Bug c++/106791] [12/13 " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: gcc at hazardy dot de @ 2022-08-31 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106791
Bug ID: 106791
Summary: [12 Regression] Operator Lookup with using namespace
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gcc at hazardy dot de
Target Milestone: ---
My Catch Testprojects fail with GCC 12, some in a namespace provided
equality-operators which are brought into the gobal namespace with "using
namespace" are not found anymore.
I have narrowed down to: https://godbolt.org/z/GqnvYMGYq
I was not able to narrow it down without using Catch.
If you define WorkAround it compiles with GCC 11 and 12.
#include <catch.hpp>
struct Type1 {};
struct Type2 {};
namespace Op {
bool operator==(const Type1&, const Type2&);
}
//#define WorkAround
#ifndef WorkAround
using namespace Op;
#else
bool operator==(const Type1& t1, const Type2& t2) {
return Op::operator==(t1, t2);
}
#endif
TEST_CASE("") {
Type1 t1;
Type2 t2;
CHECK(t1 == t2);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/106791] [12/13 Regression] Operator Lookup with using namespace
2022-08-31 12:57 [Bug c++/106791] New: [12 Regression] Operator Lookup with using namespace gcc at hazardy dot de
@ 2022-08-31 13:05 ` rguenth at gcc dot gnu.org
2022-08-31 13:12 ` [Bug c++/106791] [12/13 Regression] Operator Lookup with using namespace since r12-702-g6ab1176667734bd6 marxin at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-31 13:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106791
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[12 Regression] Operator |[12/13 Regression] Operator
|Lookup with using namespace |Lookup with using namespace
Target Milestone|--- |12.3
Keywords| |rejects-valid
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/106791] [12/13 Regression] Operator Lookup with using namespace since r12-702-g6ab1176667734bd6
2022-08-31 12:57 [Bug c++/106791] New: [12 Regression] Operator Lookup with using namespace gcc at hazardy dot de
2022-08-31 13:05 ` [Bug c++/106791] [12/13 " rguenth at gcc dot gnu.org
@ 2022-08-31 13:12 ` marxin at gcc dot gnu.org
2022-08-31 13:19 ` redi at gcc dot gnu.org
2022-08-31 13:20 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-08-31 13:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106791
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |marxin at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
Summary|[12/13 Regression] Operator |[12/13 Regression] Operator
|Lookup with using namespace |Lookup with using namespace
| |since
| |r12-702-g6ab1176667734bd6
Ever confirmed|0 |1
Last reconfirmed| |2022-08-31
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-702-g6ab1176667734bd6.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/106791] [12/13 Regression] Operator Lookup with using namespace since r12-702-g6ab1176667734bd6
2022-08-31 12:57 [Bug c++/106791] New: [12 Regression] Operator Lookup with using namespace gcc at hazardy dot de
2022-08-31 13:05 ` [Bug c++/106791] [12/13 " rguenth at gcc dot gnu.org
2022-08-31 13:12 ` [Bug c++/106791] [12/13 Regression] Operator Lookup with using namespace since r12-702-g6ab1176667734bd6 marxin at gcc dot gnu.org
@ 2022-08-31 13:19 ` redi at gcc dot gnu.org
2022-08-31 13:20 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-31 13:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106791
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is not a valid testcase for a GCC bug report. As requested when creating
the bug, please read https://gcc.gnu.org/bugs and provide the missing info next
time.
The example can be reduced to:
namespace test
{
template<class T, class U>
bool checkEqual(const T& t, const U& u)
{
return t == u;
}
}
struct Type1 {};
struct Type2 {};
namespace Op {
bool operator==(const Type1&, const Type2&);
}
//#define WorkAround
#ifndef WorkAround
using namespace Op;
#else
bool operator==(const Type1& t1, const Type2& t2) {
return Op::operator==(t1, t2);
}
#endif
bool fixture()
{
Type1 t1;
Type2 t2;
return test::checkEqual(t1, t2);
}
GCC is correct to reject this. GCC 11 and older releases had a bug in name
lookup for operators, which has been fixed. See PR51577 for more info.
Clang also rejects your code, with a similar error.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/106791] [12/13 Regression] Operator Lookup with using namespace since r12-702-g6ab1176667734bd6
2022-08-31 12:57 [Bug c++/106791] New: [12 Regression] Operator Lookup with using namespace gcc at hazardy dot de
` (2 preceding siblings ...)
2022-08-31 13:19 ` redi at gcc dot gnu.org
@ 2022-08-31 13:20 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-31 13:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106791
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Closing as invalid.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-31 13:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 12:57 [Bug c++/106791] New: [12 Regression] Operator Lookup with using namespace gcc at hazardy dot de
2022-08-31 13:05 ` [Bug c++/106791] [12/13 " rguenth at gcc dot gnu.org
2022-08-31 13:12 ` [Bug c++/106791] [12/13 Regression] Operator Lookup with using namespace since r12-702-g6ab1176667734bd6 marxin at gcc dot gnu.org
2022-08-31 13:19 ` redi at gcc dot gnu.org
2022-08-31 13:20 ` 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).