From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29716 invoked by alias); 2 Feb 2014 09:26:35 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 29698 invoked by uid 89); 2 Feb 2014 09:26:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail2-relais-roc.national.inria.fr Received: from mail2-relais-roc.national.inria.fr (HELO mail2-relais-roc.national.inria.fr) (192.134.164.83) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sun, 02 Feb 2014 09:26:32 +0000 Received: from ip-103.net-81-220-142.rev.numericable.fr (HELO laptop-mg.local) ([81.220.142.103]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Feb 2014 10:26:28 +0100 Date: Sun, 02 Feb 2014 09:26:00 -0000 From: Marc Glisse Reply-To: gcc-help@gcc.gnu.org To: Joaquin M Lopez Munoz cc: gcc-help@gcc.gnu.org Subject: Re: Problem with braced-init-lists and explicit ctors In-Reply-To: Message-ID: References: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-SW-Source: 2014-02/txt/msg00005.txt.bz2 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( 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