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&&)

Reply via email to