[LLVMbugs] [Bug 12092] New: unexpected ambiguity in overload resolution with braced-init-list

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 26 16:29:52 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=12092

             Bug #: 12092
           Summary: unexpected ambiguity in overload resolution with
                    braced-init-list
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


clang rejects:

  std::vector<std::string> v;
  v = {"hello", "world"};

claiming an ambiguity. Cut-down testcase:

  #include <initializer_list>
  struct S {
    S(const char*);
  };
  struct V {
    template<typename T> V(T, T);
    void f(std::initializer_list<S>);
    void f(const V &);
  };

  void g() {
    extern V s;
    s.f({"foo", "bar"});
  }

Here, clang claims an ambiguity between:

  s.f(V<const char*>("foo", "bar"));

and

  s.f(initializer_list<S>{S("foo"), S("bar")});

g++ accepts both examples and prefers the function with the initializer_list
argument. I'm hopeful that g++ is right and this is a clang bug!

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list