Matching function declarations are considered overloads if one is inline friend
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Consider the following permutation of the example from #180816, when definition of `bar` is put before definition of `Name` (https://godbolt.org/z/63YMcvzMs):
```cpp
struct Name;
int bar(Name&) { return 0; }
struct Name {
friend inline int bar(Name&);
};
int main() {
Name name;
return bar(name);
}
```
Clang, unlike other three implementations, successfully performs declaration matching between definition of `bar` and its friend declaration, diagnosing `inline` specifier ([[dcl.inline]/4](https://eel.is/c++draft/dcl.inline#4.sentence-1)), but then it still considers declarations of `bar` to declare overloads, and call to `bar` is diagnosed as ambiguous, which is not correct.
CC @shafik
Contributor guide
Research direction
Start by compiling the reproducer in the linked Compiler Explorer example and compare Clang's result with the other implementations. Review the declaration-matching and overload behavior described under [dcl.inline]/4, using issue #180816 for related context. Done means the matching declarations are not treated as ambiguous overloads and the inline diagnostic remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100