-
Couldn't load subscription status.
- Fork 15k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issue
Description
Generated by Fuzzer.
GCC correctly accepts the call as unambiguous, selecting the more specific [1] overload, while Clang incorrectly rejects it with an "ambiguous call" error.
Reproducer: https://godbolt.org/z/4YTerK8Ws
Program:
int f2(int const (&)[]) { return 1; }
int f2(int const (&)[1]) {
const int size = 1;
int array[size] = {42};
if (array[0] > 0) {
int value_2 = f2(array);
return value_2;
}
return 2;
}
int main() {
if (f2({}) != 1) return -1;
if (f2({1}) != 2) return -1;
return 0;
}Clang rejects it with following error message:
<source>:6:19: error: call to 'f2' is ambiguous
6 | int value_2 = f2(array);
| ^~
<source>:1:5: note: candidate function
1 | int f2(int const (&)[]) { return 1; }
| ^
<source>:2:5: note: candidate function
2 | int f2(int const (&)[1]) {
| ^
1 error generated.
Compiler returned: 1Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issue