Commit ad47114
In MSVC compatibility mode, friend function declarations behave as function declarations
Before C++20, MSVC treated any friend function declaration as a function declaration, so the following code would compile despite funGlob being declared after its first call:
```
class Glob {
public:
friend void funGlob();
void test() {
funGlob();
}
};
void funGlob() {}
```
This proposed patch mimics the MSVC behavior when in MSVC compatibility mode
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D1246131 parent bc8e601 commit ad47114
File tree
3 files changed
+63
-5
lines changed- clang
- lib/Sema
- test/SemaCXX
- unittests/AST
3 files changed
+63
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9632 | 9632 | | |
9633 | 9633 | | |
9634 | 9634 | | |
| 9635 | + | |
| 9636 | + | |
| 9637 | + | |
| 9638 | + | |
9635 | 9639 | | |
9636 | | - | |
| 9640 | + | |
9637 | 9641 | | |
9638 | 9642 | | |
9639 | | - | |
| 9643 | + | |
9640 | 9644 | | |
9641 | 9645 | | |
9642 | 9646 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2658 | 2658 | | |
2659 | 2659 | | |
2660 | 2660 | | |
2661 | | - | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
2662 | 2665 | | |
2663 | 2666 | | |
2664 | 2667 | | |
| |||
2702 | 2705 | | |
2703 | 2706 | | |
2704 | 2707 | | |
2705 | | - | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
2706 | 2712 | | |
2707 | 2713 | | |
2708 | 2714 | | |
| |||
2793 | 2799 | | |
2794 | 2800 | | |
2795 | 2801 | | |
2796 | | - | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
2797 | 2806 | | |
2798 | 2807 | | |
2799 | 2808 | | |
| |||
0 commit comments