[LLVMbugs] [Bug 11377] New: Unhelpful error message on template typo

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 14 16:21:23 PST 2011


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

             Bug #: 11377
           Summary: Unhelpful error message on template typo
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mclow at qualcomm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7611
  --> http://llvm.org/bugs/attachment.cgi?id=7611
program showing error.

When compiling the attached file, I get the following mystifying error message:

<pre>
$ clang++ huh2.cpp
huh2.cpp:23:2: error: no matching function for call to 'test_sequence'
        test_sequence ( v, lessThan10, v.begin () + 5 );
        ^~~~~~~~~~~~~
huh2.cpp:7:6: note: candidate template ignored: substitution failure [with
      Container = std::vector<int, std::allocator<int> >, Predicate = bool
      (*)(int)]
void test_sequence ( Container &v, Predicate comp, typename ...
     ^
1 error generated.
</pre>

I passed three parameters to the template - not two, like the compiler is
claiming. What's up with that?

The answer, btw, is that in the template declaration, I misspelled "iterator"
as "interator". If clang would tell me that std::vector doesn't have a type
named "interator", I would have gone right to the problem.

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