[LLVMbugs] [Bug 21228] New: Improve substitution failure diagnostic

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 9 09:35:39 PDT 2014


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

            Bug ID: 21228
           Summary: Improve substitution failure diagnostic
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When the "error: no matching function for call to 'some_function'" appears, a 
list of candidates is displayed along with the reason why they have been
ignored. 
Example:

somefile.hpp:1:1: note: candidate template ignored: substitution failure :
      deduced non-type template argument does not have the same type as the its
corresponding template parameter
      ('long long' vs 'my_int' (aka 'int'))

In these messages it is clear that there was a substitution failure due to a
type mismatch (e.g. long long vs int). However, it is not 100% clear which type
the function was expecting, and which type it was provided. One might _deduce_
that since the deduced paramenter is mentioned first, then it must be 'long
long' in this case, while since the corresponding template parameter is
mentioned second, it must be 'int'.

I would rather free the user from having to deduce anything (that is what the
compiler is there for), and make the note idiot proof: 

somefile.hpp:35:13: note: candidate template ignored: substitution failure :
      deduced non-type template argument ('long long') does not have the same
type as its corresponding template parameter ('my_int' aka 'int').
      [ deduced 'long long' != provided 'my_int' (aka 'int') ]


...or the other way around:

 [ deduced 'my_int' (aka 'int') != 'long long' ]

such that the message is correct.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141009/a8746ecd/attachment.html>


More information about the llvm-bugs mailing list