[llvm-bugs] [Bug 44207] New: [msabi] wrong mangling for auto-typed non-type template parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 2 14:20:39 PST 2019


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

            Bug ID: 44207
           Summary: [msabi] wrong mangling for auto-typed non-type
                    template parameters
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk,
                    rnk at google.com

Clang incorrectly mangles non-type template parameters whose types involve
`auto` when targeting the MS ABI. Testcase:

template<auto *P> struct X {};

int a;
void f(X<&a>) {}
void f(X<(const int*)&a>) {}

MSVC mangles these as:

?f@@YAXU?$X@$MPEAH1?a@@3HA@@@Z
?f@@YAXU?$X@$MPEBH1?a@@3HA@@@Z

Clang wants to mangle them both as:

?f@@YAXU?$X@$1?a@@3HA@@@Z

In practice, Clang rejects both of the above in Sema before getting to
mangling, but commenting out either of the definitions of 'f' results in a
program for which Clang generates wrong manglings under the MS ABI:
https://godbolt.org/z/xDDuD7

-- 
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/20191202/899ddd1d/attachment.html>


More information about the llvm-bugs mailing list