[llvm-bugs] [Bug 52191] New: Clang does not match GCC re: instantiation-dependent expressions in mangling
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 15 15:49:54 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52191
Bug ID: 52191
Summary: Clang does not match GCC re: instantiation-dependent
expressions in mangling
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Keywords: ABI
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: hstong at ca.ibm.com
CC: arthur.j.odwyer at gmail.com, 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
As noted by Arthur O'Dwyer in bug 28667, Clang does not mangle
instantiation-dependent (but neither type nor value dependent) expressions as
GCC does.
For example, given:
struct A { A(int); };
template <typename T> void foo(int, char (*)[sizeof(0, A(T()))]) { }
template <typename T> void foo(int, ...);
int main(void) {
foo<decltype(nullptr)>(0, 0);
foo<int>(0, 0);
}
The sizeof expression is instantiation-dependent: substitution with nullptr_t
fails.
Clang mangles the `int` specialization as `_Z3fooIiEviPA1_c` (i.e., `void
foo<int>(int, char (*) [1])`). GCC mangles it as
`_Z3fooIiEviPAszcmLi0Ecv1AcvT__E_c` (i.e., `void foo<int>(int, char (*) [sizeof
((0),((A)((int)())))])`).
Online compiler: https://gcc.godbolt.org/z/exj1onseW
--
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/20211015/880c1c61/attachment.html>
More information about the llvm-bugs
mailing list