[LLVMbugs] [Bug 16018] New: incorrect mangling for same name used for multiple types defined inside a function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 15 14:06:45 PDT 2013


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

            Bug ID: 16018
           Summary: incorrect mangling for same name used for multiple
                    types defined inside a function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

-- 
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/20130515/3af3d661/attachment.html>


More information about the llvm-bugs mailing list