1a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor// RUN: %clang_cc1 -fsyntax-only -verify %s
2a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor
3a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregortypedef int __attribute__((address_space(1))) int_1;
4a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregortypedef int __attribute__((address_space(2))) int_2;
5a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor
6a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregorvoid 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}} \
7a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor// 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}}
8a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregorvoid 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}} \
9a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor// 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}}
10a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor
11a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregorvoid test_f0() {
12a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor  int i;
13a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor  static int_1 i1;
14a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor  static int_2 i2;
15a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor
16a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor  f0(i); // expected-error{{no matching function for call to 'f0'}}
17a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor  f0(i1);
18a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor  f0(i2); // expected-error{{no matching function for call to 'f0'}}
19a6ce3e6513f56e4d46399da9e35a3165b097f59eDouglas Gregor}
20