• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST1
2 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST2
3 
4 #ifdef TEST1
5 
6 // rdar://15522601
7 class MyClass {
8  static void meth();
9 };
meth()10 void MyClass::meth() { } // expected-note {{previous}}
11 extern "C" {
_ZN7MyClass4methEv()12   void _ZN7MyClass4methEv() { } // expected-error {{definition with same mangled name as another definition}}
13 }
14 
15 #elif TEST2
16 
17 // We expect no warnings here, as there is only declaration of _ZN1TD1Ev function, no definitions.
18 extern "C" void _ZN1TD1Ev();
19 struct T {
~TT20   ~T() {}
21 };
22 
foo()23 void foo() {
24   _ZN1TD1Ev();
25   T t;
26 }
27 
_ZN2T2D2Ev()28 extern "C" void _ZN2T2D2Ev() {}; // expected-note {{previous definition is here}}
29 
30 struct T2 {
~T2T231   ~T2() {} // expected-error {{definition with same mangled name as another definition}}
32 };
33 
bar()34 void bar() {
35   _ZN2T2D2Ev();
36   T2 t;
37 }
38 
39 #else
40 
41 #error Unknwon test
42 
43 #endif
44 
45