llvm-project/clang/test/CodeGenCXX/duplicate-mangled-name.cpp
Andrey Bokhanko cab5858e1b PR17829: Proper diagnostic of mangled names conflicts
Proper diagnostic and resolution of mangled names conflicts between C++ methods
and C functions. This patch implements support for functions/methods only;
support for variables is coming separately.

Differential Revision: http://reviews.llvm.org/D11297

llvm-svn: 246438
2015-08-31 13:20:44 +00:00

45 lines
887 B
C++

// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST1
// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST2
#ifdef TEST1
// rdar://15522601
class MyClass {
static void meth();
};
void MyClass::meth() { } // expected-note {{previous}}
extern "C" {
void _ZN7MyClass4methEv() { } // expected-error {{definition with same mangled name as another definition}}
}
#elif TEST2
// We expect no warnings here, as there is only declaration of _ZN1TD1Ev function, no definitions.
extern "C" void _ZN1TD1Ev();
struct T {
~T() {}
};
void foo() {
_ZN1TD1Ev();
T t;
}
extern "C" void _ZN2T2D2Ev() {}; // expected-note {{previous definition is here}}
struct T2 {
~T2() {} // expected-error {{definition with same mangled name as another definition}}
};
void bar() {
_ZN2T2D2Ev();
T2 t;
}
#else
#error Unknwon test
#endif