overload resolution between lvalue reference and rvalue reference
问题 #include <iostream> using namespace std; void func(int (&ref)[6]) { cout << "#1" << endl; } void func(int * &&ref) { cout << "#2" << endl; } int main() { int arr[6]; func(arr); // g++(5.4): ambiguous, clang++(3.8): #2, vc++(19.11): #1 return 0; } Both functions are exact matches. Below is a quote from the standard: Standard conversion sequence S1 is a better conversion sequence than standard conversion sequence S2 if ... S1 and S2 are reference bindings (8.5.3) and neither refers to an