<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 --- - incorrect mangling for same name used for multiple types defined inside a function"
   href="http://llvm.org/bugs/show_bug.cgi?id=16018">16018</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>incorrect mangling for same name used for multiple types defined inside a function
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>richard-llvm@metafoo.co.uk
          </td>
        </tr>

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

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

inline auto f() {
  struct S {
    auto f() {
      struct S {};
      return S();
    }
  };
  return S().f();
}
typedef decltype(f()) S;
void g(S s) {}

clang++ mangles 'g' as _Z1gZZ1fvEN1S1fEvE1S_0
But g++ mangles 'g' as _Z1gZZ1fvEN1S1fEvE1S

The Itanium ABI is not spectacularly clear here, but presumably we're supposed
to have separate independent counts for the body of each function, even if one
is nested within another.

Here's another case which we get wrong (much more surprisingly; I thought we
handled this case):

inline auto f() {
  { struct S {}; }
  { struct S {}; return S(); }
}
typedef decltype(f()) S;
void g(S s) {}

Here, we mangle as _Z1gZ1fvE1S -- which is wrong.
g++ correctly uses _Z1gZ1fvE1S_0

This can be observed outside of C++1y, too, for instance by using one of these
types as a template argument.</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>