-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerdiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Description
The following code is rejected by clang-trunk:
struct payload {};
struct base: private payload {
};
struct derived: base {
friend class payload;
};The diagnostic is hard to understand. It seems the compiler treats the private inheritance statement as a member declaration or something else here:
<source>:7:18: error: 'payload' is a private member of 'payload'
7 | friend class payload;
| ^
<source>:3:14: note: constrained by private inheritance here
3 | struct base: private payload {
| ^~~~~~~~~~~~~~~
<source>:1:8: note: member is declared here
1 | struct payload {};
| ^
1 error generated.GCC and MSVC both accept it.
Please see https://godbolt.org/z/4da5TbvYe
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerdiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue