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: unassignedclangb...@nondot.org
          Reporter: richard-l...@metafoo.co.uk
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk,
                    r...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to