[LLVMbugs] [Bug 7289] New: Shouldn't stuff template parameter assignments in middle of error message

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 2 23:34:42 PDT 2010


           Summary: Shouldn't stuff template parameter assignments in
                    middle of error message
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: quality-of-implementation
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: chandlerc at gmail.com, llvmbugs at cs.uiuc.edu,
                    dgregor at apple.com

$ cat test.cc
#include <map>
#include <string>
using std::map;
using std::string;
class Closure;
template<typename T> struct id { typedef T type; };
template <typename Class, typename Arg1, typename Arg2,
          typename Arg3, typename Arg4>
Closure* NewCallback(Class* object,
                     void (Class::*method)(Arg1, Arg2, Arg3, Arg4),
                     typename id<Arg1>::type,
                     typename id<Arg2>::type,
                     typename id<Arg3>::type,
                     typename id<Arg4>::type);

struct Foo {
  void Method(map<string, string>, map<string, int>, map<int, string>, map<int,

void Use() {
  Foo f;
  NewCallback(&f, &Foo::Method,
              map<string, string>(),
              map<string, long>(),
              map<int, string>(),
              map<int, int>());
$ clang++ -fsyntax-only test.cc
test.cc:22:3: error: no matching function for call to 'NewCallback'
  NewCallback(&f, &Foo::Method,
test.cc:9:10: note: candidate function [with Class = Foo, Arg1 =
std::map<std::basic_string<char>, std::basic_string<char>,
std::less<std::basic_string<char> >,
std::allocator<std::pair<std::basic_string<char> const,
      std::basic_string<char> > > >, Arg2 = std::map<std::basic_string<char>,
int, std::less<std::basic_string<char> >,
std::allocator<std::pair<std::basic_string<char> const, int> > >, Arg3 =
      std::basic_string<char>, std::less<int>, std::allocator<std::pair<int
const, std::basic_string<char> > > >, Arg4 = std::map<int, int, std::less<int>,
std::allocator<std::pair<int const, int> > >] not viable: no known
      conversion from 'map<string, long>' to 'typename
id<map<basic_string<char>, int, less<basic_string<char> >,
allocator<pair<basic_string<char> const, int> > > >::type' (aka
'std::map<std::basic_string<char>, int,
      std::less<std::basic_string<char> >,
std::allocator<std::pair<std::basic_string<char> const, int> > >') for 4th
Closure* NewCallback(Class* object,
1 error generated.

That message would be nearly readable if not for the [with Class = Foo, Arg1 =
...] junk in the middle of the useful part. I suspect the template argument
assignments should get their own line between the error message and the source
code quote.

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