xref: /aosp_15_r20/external/clang/test/SemaCXX/out-of-line-def-mismatch.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
2*67e74705SXin Li 
3*67e74705SXin Li namespace N2 {
4*67e74705SXin Li   struct S1;
5*67e74705SXin Li 
6*67e74705SXin Li   namespace N1 {
7*67e74705SXin Li     class C1 {};
8*67e74705SXin Li 
9*67e74705SXin Li     struct S2 {
10*67e74705SXin Li       void func(S1*); // expected-note {{type of 1st parameter of member declaration does not match definition ('N2::S1 *' vs 'N2::N1::S1 *')}}
11*67e74705SXin Li       void func(C1&, unsigned, const S1*); // expected-note {{type of 3rd parameter of member declaration does not match definition ('const N2::S1 *' vs 'const N2::N1::S1 *')}}
12*67e74705SXin Li       void func(const S1*, unsigned); //expected-note {{type of 1st parameter of member declaration does not match definition ('const N2::S1 *' vs 'N2::N1::S1')}}
13*67e74705SXin Li       void func(unsigned, const S1*); // expected-note {{type of 1st parameter of member declaration does not match definition ('unsigned int' vs 'unsigned int *')}}
14*67e74705SXin Li     };
15*67e74705SXin Li 
16*67e74705SXin Li     struct S1 {};
17*67e74705SXin Li   }
18*67e74705SXin Li }
19*67e74705SXin Li 
func(S1 *)20*67e74705SXin Li void N2::N1::S2::func(S1*) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}}
func(C1 &,unsigned,const S1 *)21*67e74705SXin Li void N2::N1::S2::func(C1&, unsigned, const S1*) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}}
func(S1 *,double)22*67e74705SXin Li void N2::N1::S2::func(S1*, double) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}}
func(S1,unsigned)23*67e74705SXin Li void N2::N1::S2::func(S1, unsigned) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}}
func(unsigned *,S1 *)24*67e74705SXin Li void N2::N1::S2::func(unsigned*, S1*) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}}
25