64,639
社区成员
发帖
与我相关
我的任务
分享
1 #include <stdio.h>
2
3 int foo(int &a)
4 {
5 puts("ref");
6 }
7
8 int foo(int a)
9 {
10 puts("val");
11 }
12
13 int main()
14 {
15 int v=1;
16 foo(v);
17 }
t.cpp: In function ‘int main()’:
t.cpp:16: error: call of overloaded ‘foo(int&)’ is ambiguous
t.cpp:3: note: candidates are: int foo(int&)
t.cpp:8: note: int foo(int)