[llvm-bugs] [Bug 25343] New: Compiler error message points to function template for instantiations with the same mangled name

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 28 15:35:36 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25343

            Bug ID: 25343
           Summary: Compiler error message points to function template for
                    instantiations with the same mangled name
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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?

-- 
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/20151028/8cd29550/attachment.html>


More information about the llvm-bugs mailing list