public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114697] New: [DR 233] references in user defined conversions
@ 2024-04-11 18:33 mpolacek at gcc dot gnu.org
2024-04-11 23:31 ` [Bug c++/114697] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-04-11 18:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114697
Bug ID: 114697
Summary: [DR 233] references in user defined conversions
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
This should compile:
```
struct Z {};
struct A {
operator Z&(); // #1
operator const Z&();
};
struct B {
operator Z(); // #2
operator const Z&&();
};
const Z& r1 = A(); // OK, uses #1
const Z&& r2 = B(); // OK, uses #2
```
but we reject it with:
cwg233.C:13:15: error: conversion from ‘A’ to ‘const Z&’ is ambiguous
13 | const Z& r1 = A(); // OK, uses #1
| ^~~
cwg233.C:4:3: note: candidate: ‘A::operator Z&()’
4 | operator Z&(); // #1
| ^~~~~~~~
cwg233.C:5:3: note: candidate: ‘A::operator const Z&()’
5 | operator const Z&();
| ^~~~~~~~
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/114697] [DR 233] references in user defined conversions
2024-04-11 18:33 [Bug c++/114697] New: [DR 233] references in user defined conversions mpolacek at gcc dot gnu.org
@ 2024-04-11 23:31 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-11 23:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114697
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-04-11
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-11 23:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-11 18:33 [Bug c++/114697] New: [DR 233] references in user defined conversions mpolacek at gcc dot gnu.org
2024-04-11 23:31 ` [Bug c++/114697] " 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).