You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
620 B
33 lines
620 B
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
int fun_p(int* p) { return *p; }
|
|
int fun_v(int p) { return p; }
|
|
int fun_r(int& p) { return p; }
|
|
|
|
// cfgs should look similar for unbox_ref and unbox_ptr
|
|
|
|
// test conversions from int& to {int*, int, int&)
|
|
void unbox_ref() {
|
|
int a = 3;
|
|
int& r = a;
|
|
|
|
fun_p(&r);
|
|
fun_v(r);
|
|
fun_r(r);
|
|
}
|
|
|
|
// test conversions from int* to {int*, int, int&)
|
|
void unbox_ptr() {
|
|
int a = 3;
|
|
int* p = &a;
|
|
|
|
fun_p(p);
|
|
fun_v(*p);
|
|
fun_r(*p);
|
|
}
|