llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.68k stars 11.86k forks source link

Pack expansion mangling inadequate: error: definition with same mangled name as another definition #26427

Open hubert-reinterpretcast opened 8 years ago

hubert-reinterpretcast commented 8 years ago
Bugzilla Link 26053
Version trunk
OS Linux
CC @DougGregor

Extended Description

When a function parameter pack expands parameter packs of a member function template alongside parameter packs of an enclosing context, the mangling used (namely SUBSTPACK) is insufficient.

Online compiler: http://melpon.org/wandbox/permlink/wza71mJ5R0feCcG5

SOURCE ():

template struct A; template <typename ...> struct Tup;

template <typename ...T, typename ...U> struct A<Tup<Tup<T ...>, Tup<U ...>>> { template <typename ...TT> void foo(T ( ...fp[])(TT)) { } template <typename ...TT> void foo(U ( ...fp[])(TT)) { } };

int main(void) { A<Tup<Tup, Tup>> a; a.foo(static_cast<short ()(int)>(0)); a.foo(static_cast<wchar_t ()(int)>(0)); }

COMPILER INVOCATION:

clang++ -x c++ -std=c++11 -

ACTUAL OUTPUT:

:7:35: error: definition with same mangled name as another definition template void foo(U (* ...fp[])(TT)) { } ^ :6:35: note: previous definition is here template void foo(T (* ...fp[])(TT)) { } ^ 1 error generated. ### EXPECTED OUTPUT: (clean compile and link) ### COMPILER VERSION INFO: clang version 3.8.0 (trunk 256937) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/llvm-head/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64
llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-codegen