public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59389] New: [C++11] bogus error: call of overloaded ‘Foo(<brace-enclosed initializer list>)’ is ambiguous
@ 2013-12-04 19:31 ppluzhnikov at google dot com
  2013-12-04 19:42 ` [Bug c++/59389] " ppluzhnikov at google dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ppluzhnikov at google dot com @ 2013-12-04 19:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59389

            Bug ID: 59389
           Summary: [C++11] bogus error: call of overloaded
                    ‘Foo(<brace-enclosed initializer list>)’ is ambiguous
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/11997192

Using current trunk:
g++ (GCC) 4.9.0 20131204 (experimental)

// --- cut ---
#include <string>
#include <vector>
#include <map>

struct Foo {
  Foo(const std::map<std::string, std::vector<std::string>>&);
};

int main()
{
  Foo foo2({{"abc", {"aaa", "bbb"}}});  // OK
  Foo foo1({{"abc", {"aaa"}}});         // Error.
}
// --- cut ---

g++ -c -std=c++11 t.cc

t.cc: In function 'int main()':
t.cc:12:30: error: call of overloaded 'Foo(<brace-enclosed initializer list>)'
is ambiguous
   Foo foo1({{"abc", {"aaa"}}});         // Error.
                              ^
t.cc:12:30: note: candidates are:
t.cc:6:3: note: Foo::Foo(const std::map<std::basic_string<char>,
std::vector<std::basic_string<char> > >&)
   Foo(const std::map<std::string, std::vector<std::string>>&);
   ^
t.cc:5:8: note: constexpr Foo::Foo(const Foo&)
 struct Foo {
        ^
t.cc:5:8: note: constexpr Foo::Foo(Foo&&)
>From gcc-bugs-return-436665-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Dec 04 19:35:35 2013
Return-Path: <gcc-bugs-return-436665-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 25237 invoked by alias); 4 Dec 2013 19:35:34 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 25219 invoked by uid 48); 4 Dec 2013 19:35:31 -0000
From: "ppluzhnikov at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59389] [C++11] bogus error:=?UTF-8?Q? call of overloaded ‘Foo?=(<brace-enclosed initializer list>)=?UTF-8?Q?’ is ambiguous?Date: Wed, 04 Dec 2013 19:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ppluzhnikov at google dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-59389-4-vyqj7RuXSA@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59389-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59389-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-12/txt/msg00320.txt.bz2
Content-length: 911

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY389

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
Hmm, Clang also rejects this test:

t.cc:12:7: error: call to constructor of 'Foo' is ambiguous
  Foo foo1({{"abc", {"aaa"}}});         // Error.
      ^    ~~~~~~~~~~~~~~~~~~
t.cc:5:8: note: candidate is the implicit move constructor
struct Foo {
       ^
t.cc:5:8: note: candidate is the implicit copy constructor
t.cc:6:3: note: candidate constructor
  Foo(const std::map<std::string, std::vector<std::string>>&);
  ^
1 error generated.


I must have over-reduced the original.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-01-03 21:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-04 19:31 [Bug c++/59389] New: [C++11] bogus error: call of overloaded ‘Foo(<brace-enclosed initializer list>)’ is ambiguous ppluzhnikov at google dot com
2013-12-04 19:42 ` [Bug c++/59389] " ppluzhnikov at google dot com
2013-12-04 21:44 ` manu at gcc dot gnu.org
2013-12-15 19:48 ` ppluzhnikov at google dot com
2014-01-26 19:29 ` richard-gccbugzilla at metafoo dot co.uk
2021-07-31 20:37 ` pinskia at gcc dot gnu.org
2024-01-03 21:17 ` vital.had at gmail dot com
2024-01-03 21:24 ` pinskia at gcc dot gnu.org
2024-01-03 21:26 ` 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).