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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to