public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115343] New: Member name lookup does not consider equivalent type aliases from different base classes to be equivalent.
@ 2024-06-04 10:01 email at miropalmu dot cc
2024-06-04 18:27 ` [Bug c++/115343] " pinskia at gcc dot gnu.org
2024-06-04 18:29 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: email at miropalmu dot cc @ 2024-06-04 10:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115343
Bug ID: 115343
Summary: Member name lookup does not consider equivalent type
aliases from different base classes to be equivalent.
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: email at miropalmu dot cc
Target Milestone: ---
In following code foo::tag and bar::tag are type aliases to the same type so
member name lookup in foobar::tag should merge them and not be ambiguous.
However GCC 15.0.0 20240604 gives error about ambiguity.
```https://godbolt.org/z/fsK7ET4bY
struct tag { };
struct foo {
using tag = tag;
};
struct bar {
using tag = tag;
};
struct foobar : foo, bar { };
int main() {
foobar::tag _;
}
```
Clang is able to compile the code and it would make sense to no be ambiguous
but I'm not 100% sure, so someone with more familiarity with
[class.member.lookup] section of the standard can correct me if I'm wrong.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/115343] Member name lookup does not consider equivalent type aliases from different base classes to be equivalent.
2024-06-04 10:01 [Bug c++/115343] New: Member name lookup does not consider equivalent type aliases from different base classes to be equivalent email at miropalmu dot cc
@ 2024-06-04 18:27 ` pinskia at gcc dot gnu.org
2024-06-04 18:29 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-04 18:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115343
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the original example is invalid code to begin.
```
<source>:5:11: warning: declaration of 'using foo::tag = struct tag' changes
meaning of 'tag' [-Wchanges-meaning]
5 | using tag = tag;
| ^~~
<source>:5:17: note: used here to mean 'struct tag'
5 | using tag = tag;
| ^~~
<source>:2:8: note: declared here
2 | struct tag { };
| ^~~
```
But a simple change to the source:
```
struct tag { };
struct foo {
using tag1 = tag;
};
struct bar {
using tag1 = tag;
};
struct foobar : foo, bar { };
int main() {
foobar::tag1 _;
}
```
Gets the questionable ambiguous error message without a warning.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/115343] Member name lookup does not consider equivalent type aliases from different base classes to be equivalent.
2024-06-04 10:01 [Bug c++/115343] New: Member name lookup does not consider equivalent type aliases from different base classes to be equivalent email at miropalmu dot cc
2024-06-04 18:27 ` [Bug c++/115343] " pinskia at gcc dot gnu.org
@ 2024-06-04 18:29 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-04 18:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115343
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
MSVC rejects the code:
<source>(15): error C2385: ambiguous access of 'tag1'
<source>(15): note: could be the 'tag1' in base 'foo'
<source>(15): note: or could be the 'tag1' in base 'bar'
So does EDG:
"<source>", line 15: error: "foobar::tag1" is ambiguous
foobar::tag1 _;
^
1 error detected in the compilation of "<source>".
Which makes this me 99% sure this is a clang issue.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-04 18:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-04 10:01 [Bug c++/115343] New: Member name lookup does not consider equivalent type aliases from different base classes to be equivalent email at miropalmu dot cc
2024-06-04 18:27 ` [Bug c++/115343] " pinskia at gcc dot gnu.org
2024-06-04 18:29 ` pinskia 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).