public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hstong at ca dot ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58052] Copy initialization using conversion operator does not find correct candidates for initialization of final result
Date: Fri, 02 Aug 2013 13:51:00 -0000 [thread overview]
Message-ID: <bug-58052-4-9ck539JzKS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58052-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58052
--- Comment #2 from Hubert Tong <hstong at ca dot ibm.com> ---
(In reply to Paolo Carlini from comment #1)
> Not having spent a lot of time on this, I doubt it's a bug: the latest clang
> and icc behave exactly like gcc.
I had a vague recollection why I found the code weird to begin with.
After consideration, I found that the MSVC behaviour made sense after all.
There is wording in 12.3 [class.conv]:
At most one user-defined conversion (constructor or conversion function) is
implicitly applied to a single value.
To poke some holes in the applicability of the above wording, I will modify the
test case:
@@ -3,7 +3,8 @@ struct A {
A();
A(const A &, bool = 0);
A(const A &, short = 0);
- A(B &);
+
+ template <typename T> explicit A(T &);
};
struct B : A { };
Note that explicit constructors are not converting constructors.
The modified version of the test case works fine with clang++ and icc, but not
GCC. MSVC chokes on the "explicit".
next prev parent reply other threads:[~2013-08-02 13:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 4:45 [Bug c++/58052] New: " hstong at ca dot ibm.com
2013-08-02 13:51 ` hstong at ca dot ibm.com [this message]
2021-08-09 19:43 ` [Bug c++/58052] " pinskia at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-58052-4-9ck539JzKS@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).