[llvm-bugs] [Bug 42192] New: Mangler incorrectly handles templated decltype in parameter type

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 7 16:42:27 PDT 2019


            Bug ID: 42192
           Summary: Mangler incorrectly handles templated decltype in
                    parameter type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jorg.brown at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Given this code:

template <bool _Bp, class _If, class _Then> struct cond {
  using type = _If;
  _If memvar;

template<bool b>
void t2(decltype(cond<b, int, char>::memvar) param) { }

template void t2<true>(int);

gcc mangles this as _Z2t2ILb1EEvDtsr4condIXT_EifE6memvarE
clang mangles it as _Z2t2ILb1EEvDtsr4condIXT_EicEE6memvarE

demangler.com can demangle gcc's version but not clang's.

See gcc trunk vs clang trunk at https://godbolt.org/z/Rxn4XN

clang has been able to compile this code since at least as far back as version
3.8, but apparently has always mangled it wrong.

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/20190607/0351e580/attachment.html>

More information about the llvm-bugs mailing list