<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Type diffing should not expand (& should maybe even contract) types to canonical form where possible"
   href="http://llvm.org/bugs/show_bug.cgi?id=16613">16613</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Type diffing should not expand (& should maybe even contract) types to canonical form where possible
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dblaikie@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu, rtrieu@google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given:

template<typename T>
class foo {
};

void func(foo<std::string>);

int main() {
  foo<const std::string> f;
  func(f);
}

Clang prints the expanded (& then abbreviated with [...]) form of the type in
the type diff'd diagnostic:

"candidate function not viable: no known conversion from 'foo<const
basic_string<[...]>>' to 'foo<basic_string<[...]>>' for 1st argument"

It would be nice if we could print "foo<std::string>" here.

I'm not sure if it's the right thing to do, but even better would be if one of
the types was canonical & the other wasn't, but they were the same actual type,
we could still print the shorter, non-canonical type out.

(this comes from some callback-like code with type deduction:
void func(std::string);
callback<const std::string&> c = MakeCallback(func); // MakeCallback's type
uses type deduction & presumably ends up with the raw canonical type, not
std::string  so even without template type diffing we print out the expanded
type rather than the std::string typedef
)

The "aka" (provided in cases where template type diffing doesn't trigger) is
useful but I fear it's noisier than necessary in many cases - especially when
the same sugared type is used on both sides of a type diff (in which case we
could at least provide a single aka, rather than redundantly print it on both
sides)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>