From: Marc Glisse <marc.glisse@inria.fr>
To: Joaquin M Lopez Munoz <joaquinlopezmunoz@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Problem with braced-init-lists and explicit ctors
Date: Sun, 02 Feb 2014 09:26:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.10.1402021020160.3573@laptop-mg.saclay.inria.fr> (raw)
In-Reply-To: <loom.20140202T100723-766@post.gmane.org>
On Sun, 2 Feb 2014, Joaquin M Lopez Munoz wrote:
> Using GCC 4.8 -std=c++11. The following overload resolution is not
> ambiguous as bar::bar is explicit, which is fine:
>
> struct foo
> {
> foo(int){}
> };
>
> struct bar
> {
> explicit bar(int){}
> };
>
> void f(foo){}
> void f(bar){}
>
> int main()
> {
> f(0);
> }
>
> But if I change the call statement to
>
> int main()
> {
> f({0});
> }
>
> then I get
>
> main.cpp:16:8: error: call of overloaded 'f(<brace-enclosed initializer
> list>)' is ambiguous
> f({0});
> ^
> main.cpp:16:8: note: candidates are:
> main.cpp:11:6: note: void f(foo)
> void f(foo){}
> ^
> main.cpp:12:6: note: void f(bar)
> void f(bar){}
> ^
>
> Is this a bug or am I missing some subtlety in the standard? Thank you,
If there is a subtlety, clang and intel are missing it since they accept
the code. Please file this in bugzilla.
--
Marc Glisse
next prev parent reply other threads:[~2014-02-02 9:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-02 9:10 Joaquin M Lopez Munoz
2014-02-02 9:26 ` Marc Glisse [this message]
2014-02-02 9:38 ` Joaquin M Lopez Munoz
2014-02-02 21:07 ` Michael Powell
2014-02-03 7:12 ` Jonathan Wakely
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=alpine.DEB.2.10.1402021020160.3573@laptop-mg.saclay.inria.fr \
--to=marc.glisse@inria.fr \
--cc=gcc-help@gcc.gnu.org \
--cc=joaquinlopezmunoz@gmail.com \
/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).