public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103906] New: Illegal program not detected, ambiguous conversion operator
@ 2022-01-04 20:07 agulanyan87 at gmail dot com
2022-01-04 20:30 ` [Bug c++/103906] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: agulanyan87 at gmail dot com @ 2022-01-04 20:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103906
Bug ID: 103906
Summary: Illegal program not detected, ambiguous conversion
operator
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: agulanyan87 at gmail dot com
Target Milestone: ---
Created attachment 52121
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52121&action=edit
A complete example of the issue
Please have a look at the file attached.
As you can see the conversion operator to int is ambiguous - both base classes
have the same conversion operator defined. So, I expect any call of this
conversion operator should result in a compilation error.
Unfortunately, gcc does not produce an error on this ambiguous call.
Interestingly, if a named member function is used instead of a conversion
operator, the error is currently detected. This is included in the example file
too.
Tried clang - the error is correctly detected on both member function and
conversion operator calls.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/103906] Illegal program not detected, ambiguous conversion operator
2022-01-04 20:07 [Bug c++/103906] New: Illegal program not detected, ambiguous conversion operator agulanyan87 at gmail dot com
@ 2022-01-04 20:30 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-04 20:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103906
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-01-04
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Known to fail| |4.1.2
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, I thought I had saw another bug like this but I can't find it.
Also MSVC accepts the code but uses the base from NewValue rather than what GCC
does which is uses the base from OldValue.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-04 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 20:07 [Bug c++/103906] New: Illegal program not detected, ambiguous conversion operator agulanyan87 at gmail dot com
2022-01-04 20:30 ` [Bug c++/103906] " 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).