xref: /aosp_15_r20/external/clang/test/SemaCXX/address-space-references.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s
2*67e74705SXin Li 
3*67e74705SXin Li typedef int __attribute__((address_space(1))) int_1;
4*67e74705SXin Li typedef int __attribute__((address_space(2))) int_2;
5*67e74705SXin Li 
6*67e74705SXin Li void f0(int_1 &); // expected-note{{candidate function not viable: 1st argument ('int') is in address space 0, but parameter must be in address space 1}} \
7*67e74705SXin Li // expected-note{{candidate function not viable: 1st argument ('int_2' (aka '__attribute__((address_space(2))) int')) is in address space 2, but parameter must be in address space 1}}
8*67e74705SXin Li void f0(const int_1 &); // expected-note{{candidate function not viable: 1st argument ('int') is in address space 0, but parameter must be in address space 1}} \
9*67e74705SXin Li // expected-note{{candidate function not viable: 1st argument ('int_2' (aka '__attribute__((address_space(2))) int')) is in address space 2, but parameter must be in address space 1}}
10*67e74705SXin Li 
test_f0()11*67e74705SXin Li void test_f0() {
12*67e74705SXin Li   int i;
13*67e74705SXin Li   static int_1 i1;
14*67e74705SXin Li   static int_2 i2;
15*67e74705SXin Li 
16*67e74705SXin Li   f0(i); // expected-error{{no matching function for call to 'f0'}}
17*67e74705SXin Li   f0(i1);
18*67e74705SXin Li   f0(i2); // expected-error{{no matching function for call to 'f0'}}
19*67e74705SXin Li }
20