From: Joaquin M Lopez Munoz <joaquinlopezmunoz@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Problem with braced-init-lists and explicit ctors
Date: Sun, 02 Feb 2014 09:10:00 -0000 [thread overview]
Message-ID: <loom.20140202T100723-766@post.gmane.org> (raw)
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,
JoaquÃn M López Muñoz
Telefónica Digital
next reply other threads:[~2014-02-02 9:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-02 9:10 Joaquin M Lopez Munoz [this message]
2014-02-02 9:26 ` Marc Glisse
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=loom.20140202T100723-766@post.gmane.org \
--to=joaquinlopezmunoz@gmail.com \
--cc=gcc-help@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).