<html>
    <head>
      <base href="https://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 --- - Compiler error message points to function template for instantiations with the same mangled name"
   href="https://llvm.org/bugs/show_bug.cgi?id=25343">25343</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiler error message points to function template for instantiations with the same mangled name
          </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>Windows NT
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>douglas_yung@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I am seeing a case where the compiler emits an error message which states the
compiler detected identical mangled names, but when pointing out the locations,
the duplicate and the previous definition point to the same incorrect line.

To reproduce this issue, compile the following code:

template <typename MathType, typename ElementType>
static void SplatConstructor1Test() {}

void foo() {
  SplatConstructor1Test<int, float __attribute__((__vector_size__(16)))>();
  SplatConstructor1Test<int, float __attribute__((ext_vector_type(4)))>();
}

When compiled, the compiler emits the following error messages:

repro.cpp:2:13: error: definition with same mangled name as another definition
static void SplatConstructor1Test() {}
            ^
repro.cpp:2:13: note: previous definition is here
1 error generated.


The error message should ideally direct the user to lines 5 and 6 for the
original definition and the duplicate respectively. I suspect what is happening
is that since these functions are template instantiations, the compiler creates
that code and creates the error, but since it is compiler generated code and
not user code, there really isn't a good place to report as the site of the
error to the user.

Perhaps there is some way the error message can be made better?</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>